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

Method test_center

numpy/_core/tests/test_defchararray.py:399–413  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

397 assert_array_equal(B.capitalize(), tgt)
398
399 def test_center(self):
400 A = self.A()
401 assert_(issubclass(A.center(10).dtype.type, np.bytes_))
402 C = A.center([10, 20])
403 assert_array_equal(np.char.str_len(C), [[10, 20], [10, 20], [12, 20]])
404
405 C = A.center(20, b'#')
406 assert_(np.all(C.startswith(b'#')))
407 assert_(np.all(C.endswith(b'#')))
408
409 C = np.char.center(b'FOO', [[10, 20], [15, 8]])
410 tgt = [[b' FOO ', b' FOO '],
411 [b' FOO ', b' FOO ']]
412 assert_(issubclass(C.dtype.type, np.bytes_))
413 assert_array_equal(C, tgt)
414
415 def test_decode(self):
416 A = np.char.array([b'\\u03a3'])

Callers

nothing calls this directly

Calls 7

AMethod · 0.95
assert_Function · 0.90
assert_array_equalFunction · 0.90
startswithMethod · 0.80
endswithMethod · 0.80
centerMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected