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

Method test_center

numpy/core/tests/test_defchararray.py:334–347  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

332 assert_array_equal(self.B.capitalize(), tgt)
333
334 def test_center(self):
335 assert_(issubclass(self.A.center(10).dtype.type, np.bytes_))
336 C = self.A.center([10, 20])
337 assert_array_equal(np.char.str_len(C), [[10, 20], [10, 20], [12, 20]])
338
339 C = self.A.center(20, b'#')
340 assert_(np.all(C.startswith(b'#')))
341 assert_(np.all(C.endswith(b'#')))
342
343 C = np.char.center(b'FOO', [[10, 20], [15, 8]])
344 tgt = [[b' FOO ', b' FOO '],
345 [b' FOO ', b' FOO ']]
346 assert_(issubclass(C.dtype.type, np.bytes_))
347 assert_array_equal(C, tgt)
348
349 def test_decode(self):
350 A = np.char.array([b'\\u03a3'])

Callers

nothing calls this directly

Calls 6

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