def test_absent(self): class A(object): pass with self.assertRaises(AttributeError): _get_method_from_class(A, 'do_something')
def test_is_not_method(self): class A(object): do_something = False with self.assertRaises(TypeError): _get_method_from_class(A, 'do_something')
def test_exists(self): class A(object): def do_something(self): pass self.assertEqual(A.do_something, _get_method_from_class(A, 'do_something'))