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)
def test_object(self): mro = get_bases_mro((object,)) self.assertEqual(mro, (object,)) self.check_valid(object)
def check_valid(self, cls): self.assertEqual(cls.__mro__[1:], get_bases_mro(cls.__bases__))
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)