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

Method test_replace_broadcasting

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

Source from the content-addressed store, hash-verified

540 + ['01234ABCDE6789' + '0123456789' * 2]))
541
542 def test_replace_broadcasting(self):
543 a = np.array('0,0,0').view(np.char.chararray)
544 r1 = a.replace('0', '1', count=np.arange(3))
545 assert r1.dtype == a.dtype
546 assert_array_equal(r1, np.array(['0,0,0', '1,0,0', '1,1,0']))
547 r2 = a.replace('0', [['1'], ['2']], count=np.arange(1, 4))
548 assert_array_equal(r2, np.array([['1,0,0', '1,1,0', '1,1,1'],
549 ['2,0,0', '2,2,0', '2,2,2']]))
550 r3 = a.replace(['0', '0,0', '0,0,0'], 'X')
551 assert_array_equal(r3, np.array(['X,X,X', 'X,0', 'X']))
552
553 def test_rjust(self):
554 A = self.A()

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
replaceMethod · 0.80
viewMethod · 0.45

Tested by

no test coverage detected