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

This commit is contained in:
Damien George 2018-04-05 01:03:57 +10:00
parent 7b7bbd0ee7
commit 22161acf47
1 changed files with 11 additions and 0 deletions

View File

@ -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')