Merge branch 'pytest-dev:main' into patch-1
This commit is contained in:
12
testing/example_scripts/dataclasses/test_compare_initvar.py
Normal file
12
testing/example_scripts/dataclasses/test_compare_initvar.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import InitVar
|
||||
|
||||
|
||||
@dataclass
|
||||
class Foo:
|
||||
init_only: InitVar[int]
|
||||
real_attr: int
|
||||
|
||||
|
||||
def test_demonstrate():
|
||||
assert Foo(1, 2) == Foo(1, 3)
|
||||
@@ -1,6 +1,6 @@
|
||||
anyio[curio,trio]==3.5.0
|
||||
django==4.0.3
|
||||
pytest-asyncio==0.18.2
|
||||
django==4.0.4
|
||||
pytest-asyncio==0.18.3
|
||||
pytest-bdd==5.0.0
|
||||
pytest-cov==3.0.0
|
||||
pytest-django==4.5.2
|
||||
@@ -11,5 +11,5 @@ pytest-rerunfailures==10.2
|
||||
pytest-sugar==0.9.4
|
||||
pytest-trio==0.7.0
|
||||
pytest-twisted==1.13.4
|
||||
twisted==22.2.0
|
||||
twisted==22.4.0
|
||||
pytest-xvfb==2.0.0
|
||||
|
||||
@@ -882,6 +882,13 @@ class TestAssert_reprcompare_dataclass:
|
||||
result.assert_outcomes(failed=1, passed=0)
|
||||
result.stdout.no_re_match_line(".*Differing attributes.*")
|
||||
|
||||
def test_data_classes_with_initvar(self, pytester: Pytester) -> None:
|
||||
p = pytester.copy_example("dataclasses/test_compare_initvar.py")
|
||||
# issue 9820
|
||||
result = pytester.runpytest(p, "-vv")
|
||||
result.assert_outcomes(failed=1, passed=0)
|
||||
result.stdout.no_re_match_line(".*AttributeError.*")
|
||||
|
||||
|
||||
class TestAssert_reprcompare_attrsclass:
|
||||
def test_attrs(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user