tests/basics/class_super.py: Add tests for store/delete of super attr.

pull/3696/merge
Damien George 2018-04-05 01:03:57 +10:00
rodzic 7b7bbd0ee7
commit 22161acf47
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -34,3 +34,14 @@ class B(A):
print(super().bar) # accessing attribute after super()
return super().foo().count(2) # calling a subsequent method
print(B().foo())
# store/delete of super attribute not allowed
assert hasattr(super(B, B()), 'foo')
try:
super(B, B()).foo = 1
except AttributeError:
print('AttributeError')
try:
del super(B, B()).foo
except AttributeError:
print('AttributeError')