Fix deprecations for py3k

This commit is contained in:
Ryan P Kilby 2016-09-16 13:08:26 -04:00
parent 3bfb0b7168
commit 3bdb0e9dd8
2 changed files with 13 additions and 1 deletions

View File

@ -53,6 +53,18 @@ def is_simple_callable(obj):
"""
True if the object is a callable that takes no arguments.
"""
if not hasattr(inspect, 'signature'):
return py2k_is_simple_callable(obj)
if not callable(obj):
return False
sig = inspect.signature(obj)
params = sig.parameters.values()
return all(param.default != param.empty for param in params)
def py2k_is_simple_callable(obj):
function = inspect.isfunction(obj)
method = inspect.ismethod(obj)

View File

@ -215,4 +215,4 @@ class TestSchemaGenerator(TestCase):
}
}
)
self.assertEquals(schema, expected)
self.assertEqual(schema, expected)