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

Function test_frame_getargs

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

Source from the content-addressed store, hash-verified

116
117
118def test_frame_getargs() -> None:
119 def f1(x) -> FrameType:
120 return sys._getframe(0)
121
122 fr1 = Frame(f1("a"))
123 assert fr1.getargs(var=True) == [("x", "a")]
124
125 def f2(x, *y) -> FrameType:
126 return sys._getframe(0)
127
128 fr2 = Frame(f2("a", "b", "c"))
129 assert fr2.getargs(var=True) == [("x", "a"), ("y", ("b", "c"))]
130
131 def f3(x, **z) -> FrameType:
132 return sys._getframe(0)
133
134 fr3 = Frame(f3("a", b="c"))
135 assert fr3.getargs(var=True) == [("x", "a"), ("z", {"b": "c"})]
136
137 def f4(x, *y, **z) -> FrameType:
138 return sys._getframe(0)
139
140 fr4 = Frame(f4("a", "b", c="d"))
141 assert fr4.getargs(var=True) == [("x", "a"), ("y", ("b",)), ("z", {"c": "d"})]
142
143
144class TestExceptionInfo:

Callers

nothing calls this directly

Calls 6

getargsMethod · 0.95
FrameClass · 0.90
f1Function · 0.85
f2Function · 0.85
f3Function · 0.85
f4Function · 0.85

Tested by

no test coverage detected