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

Method test_count

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

Source from the content-addressed store, hash-verified

247 assert_array_equal(np.char.str_len(B), [[3, 0], [5, 9], [12, 5]])
248
249 def test_count(self):
250 A, B = self.A(), self.B()
251 assert_(issubclass(A.count('').dtype.type, np.integer))
252 assert_array_equal(A.count('a'), [[1, 0], [0, 1], [0, 0]])
253 assert_array_equal(A.count('123'), [[0, 0], [1, 0], [1, 0]])
254 # Python doesn't seem to like counting NULL characters
255 assert_array_equal(A.count('a', 0, 2), [[1, 0], [0, 0], [0, 0]])
256 assert_array_equal(B.count('a'), [[0, 0], [0, 1], [0, 0]])
257 assert_array_equal(B.count('123'), [[0, 0], [1, 0], [1, 0]])
258
259 def test_endswith(self):
260 A = self.A()

Callers

nothing calls this directly

Calls 5

AMethod · 0.95
BMethod · 0.95
assert_Function · 0.90
assert_array_equalFunction · 0.90
countMethod · 0.45

Tested by

no test coverage detected