Add tests about matching __slots__ against structural type (PY-29233)

This commit is contained in:
Semyon Proshev
2018-05-29 17:24:38 +03:00
parent 84e61c21cd
commit 2588b3f8a0
3 changed files with 26 additions and 4 deletions
@@ -2,8 +2,29 @@ class A(object):
__slots__ = 'x', 'y'
class B(object):
__slots__ = ['x']
class C(B):
pass
class D(object):
pass
class E(D):
__slots__ = ['x']
class F:
__slots__ = ['x']
def copy_values(a):
print(a.x)
copy_values(A())
copy_values(A())
copy_values(C())
copy_values(E())
copy_values(<warning descr="Type 'D' doesn't have expected attribute 'x'">D()</warning>)