()
| 24 | |
| 25 | |
| 26 | def 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 | |
| 56 | def test_relative_time(): |
nothing calls this directly
no test coverage detected