MCPcopy Index your code
hub / github.com/numpy/numpy / test_debug_print

Function test_debug_print

numpy/_core/tests/test_nditer.py:3562–3640  ·  view source on GitHub ↗

Matches the expected output of a debug print with the actual output. Note that the iterator dump should not be considered stable API, this test is mainly to ensure the print does not crash. Currently uses a subprocess to avoid dealing with the C level `printf`s.

(capfd)

Source from the content-addressed store, hash-verified

3560
3561@pytest.mark.thread_unsafe(reason="capfd is thread-unsafe")
3562def test_debug_print(capfd):
3563 """
3564 Matches the expected output of a debug print with the actual output.
3565 Note that the iterator dump should not be considered stable API,
3566 this test is mainly to ensure the print does not crash.
3567
3568 Currently uses a subprocess to avoid dealing with the C level `printf`s.
3569 """
3570 # the expected output with all addresses and sizes stripped (they vary
3571 # and/or are platform dependent).
3572 expected = """
3573 ------ BEGIN ITERATOR DUMP ------
3574 | Iterator Address:
3575 | ItFlags: BUFFER REDUCE
3576 | NDim: 2
3577 | NOp: 2
3578 | IterSize: 50
3579 | IterStart: 0
3580 | IterEnd: 50
3581 | IterIndex: 0
3582 | Iterator SizeOf:
3583 | BufferData SizeOf:
3584 | AxisData SizeOf:
3585 |
3586 | Perm: 0 1
3587 | DTypes:
3588 | DTypes: dtype('float64') dtype('int32')
3589 | InitDataPtrs:
3590 | BaseOffsets: 0 0
3591 | Ptrs:
3592 | User/buffer ptrs:
3593 | Operands:
3594 | Operand DTypes: dtype('int64') dtype('float64')
3595 | OpItFlags:
3596 | Flags[0]: READ CAST
3597 | Flags[1]: READ WRITE CAST REDUCE
3598 |
3599 | BufferData:
3600 | BufferSize: 50
3601 | Size: 5
3602 | BufIterEnd: 5
3603 | BUFFER CoreSize: 5
3604 | REDUCE Pos: 0
3605 | REDUCE OuterSize: 10
3606 | REDUCE OuterDim: 1
3607 | Strides: 8 4
3608 | REDUCE Outer Strides: 40 0
3609 | REDUCE Outer Ptrs:
3610 | ReadTransferFn:
3611 | ReadTransferData:
3612 | WriteTransferFn:
3613 | WriteTransferData:
3614 | Buffers:
3615 |
3616 | AxisData[0]:
3617 | Shape: 5
3618 | Index: 0
3619 | Strides: 16 8

Callers

nothing calls this directly

Calls 4

splitlinesMethod · 0.80
stripMethod · 0.80
reshapeMethod · 0.80
startswithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…