mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Tighten the tests for assignment to __bases__: disallow empty tuple.
This commit is contained in:
parent
3d87e3cdf7
commit
3bbc0eea10
2 changed files with 14 additions and 0 deletions
|
@ -3485,6 +3485,14 @@ def test_mutable_bases():
|
|||
else:
|
||||
raise TestFailed, "shouldn't be able to delete .__bases__"
|
||||
|
||||
try:
|
||||
D.__bases__ = ()
|
||||
except TypeError, msg:
|
||||
if str(msg) == "a new-style class can't have only classic bases":
|
||||
raise TestFailed, "wrong error message for .__bases__ = ()"
|
||||
else:
|
||||
raise TestFailed, "shouldn't be able to set .__bases__ to ()"
|
||||
|
||||
try:
|
||||
D.__bases__ = (D,)
|
||||
except TypeError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue