MCPcopy Index your code
hub / github.com/encode/django-rest-framework / test_method

Method test_method

tests/test_fields.py:38–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36class TestIsSimpleCallable:
37
38 def test_method(self):
39 class Foo:
40 @classmethod
41 def classmethod(cls):
42 pass
43
44 def valid(self):
45 pass
46
47 def valid_kwargs(self, param='value'):
48 pass
49
50 def valid_vargs_kwargs(self, *args, **kwargs):
51 pass
52
53 def invalid(self, param):
54 pass
55
56 assert is_simple_callable(Foo.classmethod)
57
58 # unbound methods
59 assert not is_simple_callable(Foo.valid)
60 assert not is_simple_callable(Foo.valid_kwargs)
61 assert not is_simple_callable(Foo.valid_vargs_kwargs)
62 assert not is_simple_callable(Foo.invalid)
63
64 # bound methods
65 assert is_simple_callable(Foo().valid)
66 assert is_simple_callable(Foo().valid_kwargs)
67 assert is_simple_callable(Foo().valid_vargs_kwargs)
68 assert not is_simple_callable(Foo().invalid)
69
70 def test_function(self):
71 def simple():

Callers

nothing calls this directly

Calls 2

is_simple_callableFunction · 0.90
FooClass · 0.85

Tested by

no test coverage detected