Move 3.6-syntaxed test to test_next_gen.py
This commit is contained in:
parent
9ef5ff7740
commit
e79b0a72ef
|
@ -21,7 +21,7 @@ from hypothesis.strategies import booleans, integers, lists, sampled_from, text
|
|||
import attr
|
||||
|
||||
from attr import _config
|
||||
from attr._compat import PY2, PY36, PY310, ordered_dict
|
||||
from attr._compat import PY2, PY310, ordered_dict
|
||||
from attr._make import (
|
||||
Attribute,
|
||||
Factory,
|
||||
|
@ -429,41 +429,6 @@ class TestTransformAttrs(object):
|
|||
|
||||
assert d.x == d.xx()
|
||||
|
||||
@pytest.mark.skipif(not PY36, reason="NG is 3.6+-only")
|
||||
def test_mro_ng(self):
|
||||
"""
|
||||
Attributes and methods are looked up the same way in NG by default.
|
||||
|
||||
See #428
|
||||
"""
|
||||
|
||||
@attr.define
|
||||
class A:
|
||||
|
||||
x: int = 10
|
||||
|
||||
def xx(self):
|
||||
return 10
|
||||
|
||||
@attr.define
|
||||
class B(A):
|
||||
y: int = 20
|
||||
|
||||
@attr.define
|
||||
class C(A):
|
||||
x: int = 50
|
||||
|
||||
def xx(self):
|
||||
return 50
|
||||
|
||||
@attr.define
|
||||
class D(B, C):
|
||||
pass
|
||||
|
||||
d = D()
|
||||
|
||||
assert d.x == d.xx()
|
||||
|
||||
def test_inherited(self):
|
||||
"""
|
||||
Inherited Attributes have `.inherited` True, otherwise False.
|
||||
|
|
|
@ -333,3 +333,37 @@ class TestNextGen:
|
|||
# Validates
|
||||
with pytest.raises(ValueError, match="must be >=10"):
|
||||
inst.x = "9"
|
||||
|
||||
def test_mro_ng(self):
|
||||
"""
|
||||
Attributes and methods are looked up the same way in NG by default.
|
||||
|
||||
See #428
|
||||
"""
|
||||
|
||||
@attr.define
|
||||
class A:
|
||||
|
||||
x: int = 10
|
||||
|
||||
def xx(self):
|
||||
return 10
|
||||
|
||||
@attr.define
|
||||
class B(A):
|
||||
y: int = 20
|
||||
|
||||
@attr.define
|
||||
class C(A):
|
||||
x: int = 50
|
||||
|
||||
def xx(self):
|
||||
return 50
|
||||
|
||||
@attr.define
|
||||
class D(B, C):
|
||||
pass
|
||||
|
||||
d = D()
|
||||
|
||||
assert d.x == d.xx()
|
||||
|
|
Loading…
Reference in New Issue