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

Method test_rjust

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

Source from the content-addressed store, hash-verified

436 assert_array_equal(R, tgt)
437
438 def test_rjust(self):
439 assert_(issubclass(self.A.rjust(10).dtype.type, np.bytes_))
440
441 C = self.A.rjust([10, 20])
442 assert_array_equal(np.char.str_len(C), [[10, 20], [10, 20], [12, 20]])
443
444 C = self.A.rjust(20, b'#')
445 assert_(np.all(C.startswith(b'#')))
446 assert_array_equal(C.endswith(b'#'),
447 [[False, True], [False, False], [False, False]])
448
449 C = np.char.rjust(b'FOO', [[10, 20], [15, 8]])
450 tgt = [[b' FOO', b' FOO'],
451 [b' FOO', b' FOO']]
452 assert_(issubclass(C.dtype.type, np.bytes_))
453 assert_array_equal(C, tgt)
454
455 def test_rpartition(self):
456 P = self.A.rpartition([b'3', b'M'])

Callers

nothing calls this directly

Calls 6

assert_Function · 0.90
assert_array_equalFunction · 0.90
rjustMethod · 0.80
startswithMethod · 0.80
endswithMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected