def test_invalid(self): with self.assertRaises(TypeError): common_ancestor()
def test_common_acestor_of_collections(self): self.assertEqual(list, common_ancestor([1, 2, 3], ['a', 'b', 'c']))
def test_special_args(self): self.assertEqual(NoneType, common_ancestor(None, None)) self.assertEqual(int, common_ancestor(42))
def test_common_ancestor(self): self.assertEqual(C, common_ancestor(E(), C(), D(), E())) self.assertEqual(B, common_ancestor(E(), C(), D(), E(), B())) self.assertEqual(object, common_ancestor(E(), C(), D(), E(), B(), 42))