fname
stringlengths
63
176
rel_fname
stringclasses
706 values
line
int64
-1
4.5k
name
stringlengths
1
81
kind
stringclasses
2 values
category
stringclasses
2 values
info
stringlengths
0
77.9k
⌀
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,395
no_fnmatch_line
ref
function
result.stdout.no_fnmatch_line("*INTERNALERROR*")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,396
no_fnmatch_line
ref
function
result.stderr.no_fnmatch_line("*INTERNALERROR*")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,399
test_regression_nagative_line_index
def
function
def test_regression_nagative_line_index(pytester: Pytester) -> None: """ With Python 3.10 alphas, there was an INTERNALERROR reported in https://github.com/pytest-dev/pytest/pull/8227 This test ensures it does not regress. """ pytester.makepyfile( """ import ast import py...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,405
makepyfile
ref
function
pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,416
runpytest
ref
function
result = pytester.runpytest()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,417
fnmatch_lines
ref
function
result.stdout.fnmatch_lines(["* 1 failed in *"])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,418
no_fnmatch_line
ref
function
result.stdout.no_fnmatch_line("*INTERNALERROR*")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,419
no_fnmatch_line
ref
function
result.stderr.no_fnmatch_line("*INTERNALERROR*")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,422
usefixtures
ref
function
@pytest.mark.usefixtures("limited_recursion_depth")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,423
test_exception_repr_extraction_error_on_recursion
def
function
def test_exception_repr_extraction_error_on_recursion(): """ Ensure we can properly detect a recursion error even if some locals raise error on comparison (#2459). """ class numpy_like: def __eq__(self, other): if type(other) is numpy_like: raise ValueError( ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,429
numpy_like
def
class
__eq__
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,437
a
def
function
def a(x): return b(numpy_like()) def b(x): return a(numpy_like()) with pytest.raises(RuntimeError) as excinfo: a(numpy_like()) matcher = LineMatcher(str(excinfo.getrepr()).splitlines()) matcher.fnmatch_lines( [ "!!! Recursion error detected, but an erro...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,438
b
ref
function
return b(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,438
numpy_like
ref
function
return b(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,440
b
def
function
def b(x): return a(numpy_like()) with pytest.raises(RuntimeError) as excinfo: a(numpy_like()) matcher = LineMatcher(str(excinfo.getrepr()).splitlines()) matcher.fnmatch_lines( [ "!!! Recursion error detected, but an error occurred locating the origin of recursion.",...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,441
a
ref
function
return a(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,441
numpy_like
ref
function
return a(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,443
raises
ref
function
with pytest.raises(RuntimeError) as excinfo:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,444
a
ref
function
a(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,444
numpy_like
ref
function
a(numpy_like())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,446
LineMatcher
ref
function
matcher = LineMatcher(str(excinfo.getrepr()).splitlines())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,446
getrepr
ref
function
matcher = LineMatcher(str(excinfo.getrepr()).splitlines())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,447
fnmatch_lines
ref
function
matcher.fnmatch_lines(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,456
usefixtures
ref
function
@pytest.mark.usefixtures("limited_recursion_depth")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,457
test_no_recursion_index_on_recursion_error
def
function
def test_no_recursion_index_on_recursion_error(): """ Ensure that we don't break in case we can't find the recursion index during a recursion error (#2486). """ class RecursionDepthError: def __getattr__(self, attr): return getattr(self, "_" + attr) with pytest.raises(Runti...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,463
RecursionDepthError
def
class
__getattr__
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,467
raises
ref
function
with pytest.raises(RuntimeError) as excinfo:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,468
RecursionDepthError
ref
function
RecursionDepthError().trigger
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_excinfo.py
testing/code/test_excinfo.py
1,469
getrepr
ref
function
assert "maximum recursion" in str(excinfo.getrepr())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
22
test_source_str_function
def
function
def test_source_str_function() -> None: x = Source("3") assert str(x) == "3" x = Source(" 3") assert str(x) == "3" x = Source( """ 3 """ ) assert str(x) == "\n3"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
23
Source
ref
function
x = Source("3")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
26
Source
ref
function
x = Source(" 3")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
29
Source
ref
function
x = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
37
test_source_from_function
def
function
def test_source_from_function() -> None: source = Source(test_source_str_function) assert str(source).startswith("def test_source_str_function() -> None:")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
38
Source
ref
function
source = Source(test_source_str_function)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
42
test_source_from_method
def
function
def test_source_from_method() -> None: class TestClass: def test_method(self): pass source = Source(TestClass().test_method) assert source.lines == ["def test_method(self):", " pass"]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
43
TestClass
def
class
test_method
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
44
test_method
def
function
def test_method(self): pass source = Source(TestClass().test_method) assert source.lines == ["def test_method(self):", " pass"]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
47
Source
ref
function
source = Source(TestClass().test_method)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
47
TestClass
ref
function
source = Source(TestClass().test_method)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
51
test_source_from_lines
def
function
def test_source_from_lines() -> None: lines = ["a \n", "b\n", "c"] source = Source(lines) assert source.lines == ["a ", "b", "c"]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
53
Source
ref
function
source = Source(lines)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
57
test_source_from_inner_function
def
function
def test_source_from_inner_function() -> None: def f(): raise NotImplementedError() source = Source(f) assert str(source).startswith("def f():")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
58
f
def
function
def f(): raise NotImplementedError() source = Source(f) assert str(source).startswith("def f():")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
61
Source
ref
function
source = Source(f)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
65
test_source_strips
def
function
def test_source_strips() -> None: source = Source("") assert source == Source() assert str(source) == "" assert source.strip() == source
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
66
Source
ref
function
source = Source("")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
67
Source
ref
function
assert source == Source()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
72
test_source_strip_multiline
def
function
def test_source_strip_multiline() -> None: source = Source() source.lines = ["", " hello", " "] source2 = source.strip() assert source2.lines == [" hello"]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
73
Source
ref
function
source = Source()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
79
TestAccesses
def
class
setup_class test_getrange test_getrange_step_not_supported test_getline test_len test_iter
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
80
setup_class
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
81
Source
ref
function
self.source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
90
test_getrange
def
function
def test_getrange(self) -> None: x = self.source[0:2] assert len(x.lines) == 2 assert str(x) == "def f(x):\n pass" def test_getrange_step_not_supported(self) -> None: with pytest.raises(IndexError, match=r"step"): self.source[::2] def test_getline(self) -> No...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
95
test_getrange_step_not_supported
def
function
def test_getrange_step_not_supported(self) -> None: with pytest.raises(IndexError, match=r"step"): self.source[::2] def test_getline(self) -> None: x = self.source[0] assert x == "def f(x):" def test_len(self) -> None: assert len(self.source) == 4 def test_...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
96
raises
ref
function
with pytest.raises(IndexError, match=r"step"):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
99
test_getline
def
function
def test_getline(self) -> None: x = self.source[0] assert x == "def f(x):" def test_len(self) -> None: assert len(self.source) == 4 def test_iter(self) -> None: values = [x for x in self.source] assert len(values) == 4
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
103
test_len
def
function
def test_len(self) -> None: assert len(self.source) == 4 def test_iter(self) -> None: values = [x for x in self.source] assert len(values) == 4
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
106
test_iter
def
function
def test_iter(self) -> None: values = [x for x in self.source] assert len(values) == 4
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
111
TestSourceParsing
def
class
setup_class test_getstatement test_getstatementrange_triple_quoted test_getstatementrange_within_constructs test_getstatementrange_bug test_getstatementrange_bug2 test_getstatementrange_ast_issue58 test_getstatementrange_out_of_bounds_py3 test_getstatementrange_with_syntaxerror_issue7
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
112
setup_class
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
113
Source
ref
function
self.source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
122
test_getstatement
def
function
def test_getstatement(self) -> None: # print str(self.source) ass = str(self.source[1:]) for i in range(1, 4): # print "trying start in line %r" % self.source[i] s = self.source.getstatement(i) # x = s.deindent() assert str(s) == ass def t...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
127
getstatement
ref
function
s = self.source.getstatement(i)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
131
test_getstatementrange_triple_quoted
def
function
def test_getstatementrange_triple_quoted(self) -> None: # print str(self.source) source = Source( """hello(''' ''')""" ) s = source.getstatement(0) assert s == source s = source.getstatement(1) assert s == source def test_getstatementr...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
133
Source
ref
function
source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
137
getstatement
ref
function
s = source.getstatement(0)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
139
getstatement
ref
function
s = source.getstatement(1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
142
test_getstatementrange_within_constructs
def
function
def test_getstatementrange_within_constructs(self) -> None: source = Source( """\ try: try: raise ValueError except SomeThing: pass finally: 42 """ ) assert len...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
143
Source
ref
function
source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
158
getstatementrange
ref
function
assert source.getstatementrange(2) == (2, 3)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
159
getstatementrange
ref
function
assert source.getstatementrange(3) == (3, 4)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
160
getstatementrange
ref
function
assert source.getstatementrange(4) == (4, 5)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
162
getstatementrange
ref
function
assert source.getstatementrange(6) == (6, 7)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
164
test_getstatementrange_bug
def
function
def test_getstatementrange_bug(self) -> None: source = Source( """\ try: x = ( y + z) except: pass """ ) assert len(source) == 6 assert source.getstatementrange(2) == (1,...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
165
Source
ref
function
source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
176
getstatementrange
ref
function
assert source.getstatementrange(2) == (1, 4)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
178
test_getstatementrange_bug2
def
function
def test_getstatementrange_bug2(self) -> None: source = Source( """\ assert ( 33 == [ X(3, b=1, c=2 ), ] ) """ ) assert len...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
179
Source
ref
function
source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
193
getstatementrange
ref
function
assert source.getstatementrange(5) == (0, 9)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
195
test_getstatementrange_ast_issue58
def
function
def test_getstatementrange_ast_issue58(self) -> None: source = Source( """\ def test_some(): for a in [a for a in CAUSE_ERROR]: pass x = 3 """ ) assert getstatement(2, source).lines == source.lines[2:3] ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
196
Source
ref
function
source = Source(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
206
getstatement
ref
function
assert getstatement(2, source).lines == source.lines[2:3]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
207
getstatement
ref
function
assert getstatement(3, source).lines == source.lines[3:4]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
209
test_getstatementrange_out_of_bounds_py3
def
function
def test_getstatementrange_out_of_bounds_py3(self) -> None: source = Source("if xxx:\n from .collections import something") r = source.getstatementrange(1) assert r == (1, 2) def test_getstatementrange_with_syntaxerror_issue7(self) -> None: source = Source(":") pytest....
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
210
Source
ref
function
source = Source("if xxx:\n from .collections import something")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
211
getstatementrange
ref
function
r = source.getstatementrange(1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
214
test_getstatementrange_with_syntaxerror_issue7
def
function
def test_getstatementrange_with_syntaxerror_issue7(self) -> None: source = Source(":") pytest.raises(SyntaxError, lambda: source.getstatementrange(0))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
215
Source
ref
function
source = Source(":")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
216
raises
ref
function
pytest.raises(SyntaxError, lambda: source.getstatementrange(0))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
216
getstatementrange
ref
function
pytest.raises(SyntaxError, lambda: source.getstatementrange(0))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
219
test_getstartingblock_singleline
def
function
def test_getstartingblock_singleline() -> None: class A: def __init__(self, *args) -> None: frame = sys._getframe(1) self.source = Frame(frame).statement x = A("x", "y") values = [i for i in x.source.lines if i.strip()] assert len(values) == 1
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
220
A
def
class
__init__ __init__
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
223
Frame
ref
function
self.source = Frame(frame).statement
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
225
A
ref
function
x = A("x", "y")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
231
test_getline_finally
def
function
def test_getline_finally() -> None: def c() -> None: pass with pytest.raises(TypeError) as excinfo: teardown = None try: c(1) # type: ignore finally: if teardown: teardown() # type: ignore[unreachable] source = excinfo.traceback[-1]....
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
232
c
def
function
def c() -> None: pass with pytest.raises(TypeError) as excinfo: teardown = None try: c(1) # type: ignore finally: if teardown: teardown() # type: ignore[unreachable] source = excinfo.traceback[-1].statement assert str(source).str...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
235
raises
ref
function
with pytest.raises(TypeError) as excinfo:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
238
c
ref
function
c(1) # type: ignore
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/code/test_source.py
testing/code/test_source.py
241
teardown
ref
function
teardown() # type: ignore[unreachable]