def __repr__(self) -> str: if self.bound_class is not EMPTY: return get_class_full_name(self.bound_class) if self.bound_instance is not EMPTY: return repr(self.bound_instance) if isinstance(self.bound_provider, Provider): return repr(self.bound_provider) return get_class_full_name(self.bound_provider)
def test_str_get_class_full_name(self): self.assertEqual("MyClass", get_class_full_name("MyClass"))
def test_get_named_class_full_name(self): self.assertEqual("int#my_name", get_class_full_name(Named.get_named_class(int, "my_name")))
def test_get_generic_class_full_name(self): self.assertTrue(get_class_full_name(MyGenericClass[int]).endswith("test_utils.MyGenericClass[int]"))
def test_get_generic_builtin_class_full_name(self): self.assertEqual("typing.List[int]", get_class_full_name(List[int]))
def test_get_builtin_class_full_name(self): self.assertEqual("int", get_class_full_name(int))
def test_get_class_full_name(self): self.assertTrue(get_class_full_name(MyClass).endswith("test_utils.MyClass"))