(normalize)
| 391 | |
| 392 | @pytest.mark.parametrize("normalize", (True, False)) |
| 393 | def test_watch_explode(normalize): |
| 394 | class Foo: |
| 395 | def __init__(self, x, y): |
| 396 | self.x = x |
| 397 | self.y = y |
| 398 | |
| 399 | @pysnooper.snoop(watch_explode=('_d', '_point', 'lst + []'), normalize=normalize, |
| 400 | color=False) |
| 401 | def my_function(): |
| 402 | _d = {'a': 1, 'b': 2, 'c': 'ignore'} |
| 403 | _point = Foo(x=3, y=4) |
| 404 | lst = [7, 8, 9] |
| 405 | lst.append(10) |
| 406 | |
| 407 | with mini_toolbox.OutputCapturer(stdout=False, |
| 408 | stderr=True) as output_capturer: |
| 409 | result = my_function() |
| 410 | assert result is None |
| 411 | output = output_capturer.string_io.getvalue() |
| 412 | assert_output( |
| 413 | output, |
| 414 | ( |
| 415 | SourcePathEntry(), |
| 416 | VariableEntry('Foo'), |
| 417 | CallEntry('def my_function():'), |
| 418 | LineEntry(), |
| 419 | VariableEntry('_d'), |
| 420 | VariableEntry("_d['a']", '1'), |
| 421 | VariableEntry("_d['b']", '2'), |
| 422 | VariableEntry("_d['c']", "'ignore'"), |
| 423 | LineEntry(), |
| 424 | VariableEntry('_point'), |
| 425 | VariableEntry('_point.x', '3'), |
| 426 | VariableEntry('_point.y', '4'), |
| 427 | LineEntry(), |
| 428 | VariableEntry('lst'), |
| 429 | VariableEntry('(lst + [])[0]', '7'), |
| 430 | VariableEntry('(lst + [])[1]', '8'), |
| 431 | VariableEntry('(lst + [])[2]', '9'), |
| 432 | VariableEntry('lst + []'), |
| 433 | LineEntry(), |
| 434 | VariableEntry('lst'), |
| 435 | VariableEntry('(lst + [])[3]', '10'), |
| 436 | VariableEntry('lst + []'), |
| 437 | ReturnEntry(), |
| 438 | ReturnValueEntry('None'), |
| 439 | ElapsedTimeEntry(), |
| 440 | ), |
| 441 | normalize=normalize, |
| 442 | ) |
| 443 | |
| 444 | |
| 445 | @pytest.mark.parametrize("normalize", (True, False)) |
nothing calls this directly
no test coverage detected