blob: a1f3bfb1549eec9f60a107a03d44e3f76cd2849f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
def hasmethod(obj, methodname):
"""Does ``obj`` have a method named ``methodname``?"""
if not hasattr(obj, methodname):
return False
method = getattr(obj, methodname)
return callable(method)
|