Пример #1
0
 def check_invalid(self, bases, conflict):
     with self.assertRaisesRegex(
             TypeError,
             r"Cannot create a consistent method resolution "
             "order \(MRO\) for bases {}"
             .format(", ".join(i.__name__ for i in conflict))):
         get_bases_mro(bases)
Пример #2
0
 def test_object(self):
     mro = get_bases_mro((object,))
     self.assertEqual(mro, (object,))
     self.check_valid(object)
Пример #3
0
 def check_valid(self, cls):
     self.assertEqual(cls.__mro__[1:], get_bases_mro(cls.__bases__))
Пример #4
0
 def __init__(self, name, members, bases):
     self.name = name
     self.bases = bases
     self.mro = get_bases_mro(bases)
     self.ancestors = _get_ancestors(self.mro)
     self.members = _chain_inherited_attr("__dict__", members, self.mro)