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

Method _format_function

numpy/core/tests/test_arrayprint.py:229–235  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

227 def test_format_function(self):
228 """Test custom format function for each element in array."""
229 def _format_function(x):
230 if np.abs(x) < 1:
231 return '.'
232 elif np.abs(x) < 2:
233 return 'o'
234 else:
235 return 'O'
236
237 x = np.arange(3)
238 x_hex = "[0x0 0x1 0x2]"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected