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

Method test_axis_count

numpy/lib/tests/test_packbits.py:353–368  ·  view source on GitHub ↗
(self, kwargs)

Source from the content-addressed store, hash-verified

351 {'bitorder': 'big', 'count': None},
352 ])
353 def test_axis_count(self, kwargs):
354 packed0 = np.packbits(self.x, axis=0)
355 unpacked0 = np.unpackbits(packed0, axis=0, **kwargs)
356 assert_equal(unpacked0.dtype, np.uint8)
357 if kwargs.get('bitorder', 'big') == 'big':
358 assert_array_equal(unpacked0, self.padded2[:-1, :self.x.shape[1]])
359 else:
360 assert_array_equal(unpacked0[::-1, :], self.padded2[:-1, :self.x.shape[1]])
361
362 packed1 = np.packbits(self.x, axis=1)
363 unpacked1 = np.unpackbits(packed1, axis=1, **kwargs)
364 assert_equal(unpacked1.dtype, np.uint8)
365 if kwargs.get('bitorder', 'big') == 'big':
366 assert_array_equal(unpacked1, self.padded2[:self.x.shape[0], :-1])
367 else:
368 assert_array_equal(unpacked1[:, ::-1], self.padded2[:self.x.shape[0], :-1])
369
370 def test_bad_count(self):
371 packed0 = np.packbits(self.x, axis=0)

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_array_equalFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected