MCPcopy Create free account
hub / github.com/numpy/numpy / test_mvoid_print

Method test_mvoid_print

numpy/ma/tests/test_core.py:953–968  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

951 assert_equal(list(a[1]), [masked, 4])
952
953 def test_mvoid_print(self):
954 # Test printing a mvoid
955 mx = array([(1, 1), (2, 2)], dtype=[('a', int), ('b', int)])
956 assert_equal(str(mx[0]), "(1, 1)")
957 mx['b'][0] = masked
958 ini_display = masked_print_option._display
959 masked_print_option.set_display("-X-")
960 try:
961 assert_equal(str(mx[0]), "(1, -X-)")
962 assert_equal(repr(mx[0]), "(1, -X-)")
963 finally:
964 masked_print_option.set_display(ini_display)
965
966 # also check if there are object datatypes (see gh-7493)
967 mx = array([(1,), (2,)], dtype=[('a', 'O')])
968 assert_equal(str(mx[0]), "(1,)")
969
970 def test_mvoid_multidim_print(self):
971

Callers

nothing calls this directly

Calls 3

arrayFunction · 0.90
assert_equalFunction · 0.90
set_displayMethod · 0.80

Tested by

no test coverage detected