mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
move test to a more appropiate one
This commit is contained in:
parent
5ce73759bf
commit
accb3d0014
1 changed files with 30 additions and 25 deletions
|
|
@ -3811,31 +3811,6 @@ order (MRO) for bases """
|
|||
self.assertEqual(e.a, 2)
|
||||
self.assertEqual(C2.__subclasses__(), [D])
|
||||
|
||||
# stuff that shouldn't:
|
||||
class L(list):
|
||||
pass
|
||||
|
||||
try:
|
||||
L.__bases__ = (dict,)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("shouldn't turn list subclass into dict subclass")
|
||||
|
||||
try:
|
||||
list.__bases__ = (dict,)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("shouldn't be able to assign to list.__bases__")
|
||||
|
||||
try:
|
||||
D.__bases__ = (C2, list)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
assert 0, "best_base calculation found wanting"
|
||||
|
||||
try:
|
||||
del D.__bases__
|
||||
except (TypeError, AttributeError):
|
||||
|
|
@ -3906,6 +3881,36 @@ order (MRO) for bases """
|
|||
if tp is not object:
|
||||
self.assertEqual(len(tp.__bases__), 1, tp)
|
||||
|
||||
class L(list):
|
||||
pass
|
||||
|
||||
class C(object):
|
||||
pass
|
||||
|
||||
class D(C):
|
||||
pass
|
||||
|
||||
try:
|
||||
L.__bases__ = (dict,)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("shouldn't turn list subclass into dict subclass")
|
||||
|
||||
try:
|
||||
list.__bases__ = (dict,)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("shouldn't be able to assign to list.__bases__")
|
||||
|
||||
try:
|
||||
D.__bases__ = (C, list)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
assert 0, "best_base calculation found wanting"
|
||||
|
||||
|
||||
def test_mutable_bases_with_failing_mro(self):
|
||||
# Testing mutable bases with failing mro...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue