MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_code_getargs

Function test_code_getargs

testing/code/test_code.py:92–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90
91
92def test_code_getargs() -> None:
93 def f1(x):
94 raise NotImplementedError()
95
96 c1 = Code.from_function(f1)
97 assert c1.getargs(var=True) == ("x",)
98
99 def f2(x, *y):
100 raise NotImplementedError()
101
102 c2 = Code.from_function(f2)
103 assert c2.getargs(var=True) == ("x", "y")
104
105 def f3(x, **z):
106 raise NotImplementedError()
107
108 c3 = Code.from_function(f3)
109 assert c3.getargs(var=True) == ("x", "z")
110
111 def f4(x, *y, **z):
112 raise NotImplementedError()
113
114 c4 = Code.from_function(f4)
115 assert c4.getargs(var=True) == ("x", "y", "z")
116
117
118def test_frame_getargs() -> None:

Callers

nothing calls this directly

Calls 2

from_functionMethod · 0.80
getargsMethod · 0.45

Tested by

no test coverage detected