MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_val_in_range_array

Function test_val_in_range_array

lib/matplotlib/tests/test_scale.py:482–499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

480
481
482def test_val_in_range_array():
483 # Vectorized: scalar in -> scalar bool, array in -> bool array.
484 arr = np.array([0.5, -1.0, 0.0, np.nan, np.inf, 0.25])
485 cases = {
486 'linear': [True, True, True, False, False, True],
487 'log': [True, False, False, False, False, True],
488 'symlog': [True, True, True, False, False, True],
489 'asinh': [True, True, True, False, False, True],
490 'logit': [True, False, False, False, False, True],
491 }
492 for name, expected in cases.items():
493 s = mscale._scale_mapping[name](axis=None)
494 np.testing.assert_array_equal(s.val_in_range(arr), expected)
495
496 # 2D shape is preserved.
497 out = mscale._scale_mapping['log'](axis=None).val_in_range(
498 np.array([[1.0, -1.0], [0.5, np.nan]]))
499 np.testing.assert_array_equal(out, [[True, False], [True, False]])

Callers

nothing calls this directly

Calls 1

val_in_rangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…