(self)
| 497 | assert_array_equal(P, tgt) |
| 498 | |
| 499 | def test_replace(self): |
| 500 | A = self.A() |
| 501 | R = A.replace([b'3', b'a'], |
| 502 | [b'##########', b'@']) |
| 503 | tgt = [[b' abc ', b''], |
| 504 | [b'12##########45', b'MixedC@se'], |
| 505 | [b'12########## \t ##########45 \x00 ', b'UPPER']] |
| 506 | assert_(issubclass(R.dtype.type, np.bytes_)) |
| 507 | assert_array_equal(R, tgt) |
| 508 | # Test special cases that should just return the input array, |
| 509 | # since replacements are not possible or do nothing. |
| 510 | S1 = A.replace(b'A very long byte string, longer than A', b'') |
| 511 | assert_array_equal(S1, A) |
| 512 | S2 = A.replace(b'', b'') |
| 513 | assert_array_equal(S2, A) |
| 514 | S3 = A.replace(b'3', b'3') |
| 515 | assert_array_equal(S3, A) |
| 516 | S4 = A.replace(b'3', b'', count=0) |
| 517 | assert_array_equal(S4, A) |
| 518 | |
| 519 | def test_replace_count_and_size(self): |
| 520 | a = np.array(['0123456789' * i for i in range(4)] |
nothing calls this directly
no test coverage detected