mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 13:54:47 +03:00
Fix deprecations for py3k
This commit is contained in:
parent
3bfb0b7168
commit
3bdb0e9dd8
|
@ -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)
|
||||
|
||||
|
|
|
@ -215,4 +215,4 @@ class TestSchemaGenerator(TestCase):
|
|||
}
|
||||
}
|
||||
)
|
||||
self.assertEquals(schema, expected)
|
||||
self.assertEqual(schema, expected)
|
||||
|
|
Loading…
Reference in New Issue
Block a user