MCPcopy
hub / github.com/cool-RR/PySnooper / test_string_io

Function test_string_io

tests/test_pysnooper.py:26–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24
25
26def test_string_io():
27 string_io = io.StringIO()
28
29 @pysnooper.snoop(string_io, color=False)
30 def my_function(foo):
31 x = 7
32 y = 8
33 return y + x
34
35 result = my_function('baba')
36 assert result == 15
37 output = string_io.getvalue()
38 assert_output(
39 output,
40 (
41 SourcePathEntry(),
42 VariableEntry('foo', value_regex="u?'baba'"),
43 CallEntry('def my_function(foo):'),
44 LineEntry('x = 7'),
45 VariableEntry('x', '7'),
46 LineEntry('y = 8'),
47 VariableEntry('y', '8'),
48 LineEntry('return y + x'),
49 ReturnEntry('return y + x'),
50 ReturnValueEntry('15'),
51 ElapsedTimeEntry(),
52 )
53 )
54
55
56def test_relative_time():

Callers

nothing calls this directly

Calls 9

my_functionFunction · 0.85
assert_outputFunction · 0.85
SourcePathEntryClass · 0.85
VariableEntryClass · 0.85
CallEntryClass · 0.85
LineEntryClass · 0.85
ReturnEntryClass · 0.85
ReturnValueEntryClass · 0.85
ElapsedTimeEntryClass · 0.85

Tested by

no test coverage detected