mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Merge db14d301e9
into 99382f3ccb
This commit is contained in:
commit
7319b067a5
|
@ -56,7 +56,7 @@ if six.PY3:
|
|||
"""
|
||||
True if the object is a callable that takes no arguments.
|
||||
"""
|
||||
if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
|
||||
if not callable(obj):
|
||||
return False
|
||||
|
||||
sig = inspect.signature(obj)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import datetime
|
||||
import functools
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
@ -68,12 +69,17 @@ class TestIsSimpleCallable:
|
|||
def valid_vargs_kwargs(*args, **kwargs):
|
||||
pass
|
||||
|
||||
@functools.lru_cache(None)
|
||||
def wrapped_by_native_function():
|
||||
pass
|
||||
|
||||
def invalid(param, param2='value'):
|
||||
pass
|
||||
|
||||
assert is_simple_callable(simple)
|
||||
assert is_simple_callable(valid)
|
||||
assert is_simple_callable(valid_vargs_kwargs)
|
||||
assert is_simple_callable(wrapped_by_native_function)
|
||||
assert not is_simple_callable(invalid)
|
||||
|
||||
def test_4602_regression(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user