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

Method test_check_on_scalar

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

Source from the content-addressed store, hash-verified

2102class TestFillingValues:
2103
2104 def test_check_on_scalar(self):
2105 # Test _check_fill_value set to valid and invalid values
2106 _check_fill_value = np.ma.core._check_fill_value
2107
2108 fval = _check_fill_value(0, int)
2109 assert_equal(fval, 0)
2110 fval = _check_fill_value(None, int)
2111 assert_equal(fval, default_fill_value(0))
2112
2113 fval = _check_fill_value(0, "|S3")
2114 assert_equal(fval, b"0")
2115 fval = _check_fill_value(None, "|S3")
2116 assert_equal(fval, default_fill_value(b"camelot!"))
2117 assert_raises(TypeError, _check_fill_value, 1e+20, int)
2118 assert_raises(TypeError, _check_fill_value, 'stuff', int)
2119
2120 def test_check_on_fields(self):
2121 # Tests _check_fill_value with records

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
default_fill_valueFunction · 0.90
assert_raisesFunction · 0.90
_check_fill_valueFunction · 0.85

Tested by

no test coverage detected