Skip to content

Commit 193cdb5

Browse files
committed
fix tests
1 parent 8fcfb00 commit 193cdb5

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

Diff for: tests/test_issues/test_dataclass_extensions_376.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
import pytest
33
import importlib.util
4+
import dataclasses
45

56

67
def import_patch_module():
@@ -10,7 +11,6 @@ def import_patch_module():
1011
spec.loader.exec_module(mod)
1112
return mod
1213

13-
1414
def test_patch_module_emits_deprecation_warning():
1515
"""All Python versions: emits DeprecationWarning and defines compatibility symbols"""
1616
with pytest.warns(DeprecationWarning):
@@ -19,19 +19,9 @@ def test_patch_module_emits_deprecation_warning():
1919
assert hasattr(mod, "DC_CREATE_FN")
2020
assert hasattr(mod, "dataclasses_init_fn_with_kwargs")
2121
assert mod.DC_CREATE_FN is False
22-
assert mod.dataclasses_init_fn_with_kwargs is None
23-
2422

25-
@pytest.mark.skipif(sys.version_info >= (3, 13), reason="dataclass patch behavior was only relevant pre-3.13")
26-
def test_behavior_without_patch_pre_3_13():
27-
"""Ensure standard dataclass behavior (no patch) in <3.13"""
28-
import dataclasses
23+
# Check consistency with actual dataclasses module
24+
init_fn = getattr(dataclasses, "_init_fn", None)
25+
assert mod.dataclasses_init_fn_with_kwargs == init_fn
2926

30-
with pytest.raises(TypeError):
31-
@dataclasses.dataclass
32-
class Example:
33-
a: int
34-
def __post_init__(self, **kwargs): pass
3527

36-
# This will fail because unknown kwarg 'extra' is not accepted
37-
Example(a=1, extra="not allowed")

0 commit comments

Comments
 (0)