MCPcopy
hub / github.com/pytest-dev/pytest / test_getfuncargnames_methods

Function test_getfuncargnames_methods

testing/python/fixtures.py:45–68  ·  view source on GitHub ↗

Test getfuncargnames for normal methods

()

Source from the content-addressed store, hash-verified

43
44
45def test_getfuncargnames_methods():
46 """Test getfuncargnames for normal methods"""
47
48 class A:
49 def f(self, arg1, arg2="hello"):
50 raise NotImplementedError()
51
52 def g(self, /, arg1, arg2="hello"):
53 raise NotImplementedError()
54
55 def h(self, *, arg1, arg2="hello"):
56 raise NotImplementedError()
57
58 def j(self, arg1, *, arg2, arg3="hello"):
59 raise NotImplementedError()
60
61 def k(self, /, arg1, *, arg2, arg3="hello"):
62 raise NotImplementedError()
63
64 assert getfuncargnames(A().f) == ("arg1",)
65 assert getfuncargnames(A().g) == ("arg1",)
66 assert getfuncargnames(A().h) == ("arg1",)
67 assert getfuncargnames(A().j) == ("arg1", "arg2")
68 assert getfuncargnames(A().k) == ("arg1", "arg2")
69
70
71def test_getfuncargnames_staticmethod():

Callers

nothing calls this directly

Calls 2

getfuncargnamesFunction · 0.90
AClass · 0.70

Tested by

no test coverage detected