mirror of https://github.com/cool-RR/PySnooper.git
Add test for relative_time
This commit is contained in:
parent
57cec2b9af
commit
ee7be80b44
|
@ -50,6 +50,36 @@ def test_string_io():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_relative_time():
|
||||||
|
string_io = io.StringIO()
|
||||||
|
|
||||||
|
@pysnooper.snoop(string_io, relative_time=True)
|
||||||
|
def my_function(foo):
|
||||||
|
x = 7
|
||||||
|
y = 8
|
||||||
|
return y + x
|
||||||
|
|
||||||
|
result = my_function('baba')
|
||||||
|
assert result == 15
|
||||||
|
output = string_io.getvalue()
|
||||||
|
assert_output(
|
||||||
|
output,
|
||||||
|
(
|
||||||
|
SourcePathEntry(),
|
||||||
|
VariableEntry('foo', value_regex="u?'baba'"),
|
||||||
|
CallEntry('def my_function(foo):'),
|
||||||
|
LineEntry('x = 7'),
|
||||||
|
VariableEntry('x', '7'),
|
||||||
|
LineEntry('y = 8'),
|
||||||
|
VariableEntry('y', '8'),
|
||||||
|
LineEntry('return y + x'),
|
||||||
|
ReturnEntry('return y + x'),
|
||||||
|
ReturnValueEntry('15'),
|
||||||
|
ElapsedTimeEntry(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_thread_info():
|
def test_thread_info():
|
||||||
|
|
||||||
@pysnooper.snoop(thread_info=True)
|
@pysnooper.snoop(thread_info=True)
|
||||||
|
|
Loading…
Reference in New Issue