def test_get_method_function(): class X(object): def m(self): pass x = X() assert six.get_method_function(x.m) is X.__dict__["m"] py.test.raises(AttributeError, six.get_method_function, hasattr)