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

Method test_count

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

Source from the content-addressed store, hash-verified

217 assert_array_equal(np.char.str_len(self.B), [[3, 0], [5, 9], [12, 5]])
218
219 def test_count(self):
220 assert_(issubclass(self.A.count('').dtype.type, np.integer))
221 assert_array_equal(self.A.count('a'), [[1, 0], [0, 1], [0, 0]])
222 assert_array_equal(self.A.count('123'), [[0, 0], [1, 0], [1, 0]])
223 # Python doesn't seem to like counting NULL characters
224 # assert_array_equal(self.A.count('\0'), [[0, 0], [0, 0], [1, 0]])
225 assert_array_equal(self.A.count('a', 0, 2), [[1, 0], [0, 0], [0, 0]])
226 assert_array_equal(self.B.count('a'), [[0, 0], [0, 1], [0, 0]])
227 assert_array_equal(self.B.count('123'), [[0, 0], [1, 0], [1, 0]])
228 # assert_array_equal(self.B.count('\0'), [[0, 0], [0, 0], [1, 0]])
229
230 def test_endswith(self):
231 assert_(issubclass(self.A.endswith('').dtype.type, np.bool_))

Callers

nothing calls this directly

Calls 3

assert_Function · 0.90
assert_array_equalFunction · 0.90
countMethod · 0.45

Tested by

no test coverage detected