def _check(self, data, dtype=None, shape=None): data = np.asarray(data, dtype=dtype) if shape is not None: data = data.reshape(shape) array = biggus.NumpyArrayAdapter(data) result = count(array, axis=0).ndarray() expected = np.ones(data.shape[1:]) * data.shape[0] np.testing.assert_array_equal(result, expected)
def _check(self, source): array = biggus.NumpyArrayAdapter(np.arange(2, dtype=source)) agg = count(array, axis=0) self.assertEqual(agg.dtype, np.dtype('i'))
def test_multiple(self): array = biggus.NumpyArrayAdapter(np.arange(12).reshape(3, 4)) with self.assertRaises(biggus.AxisSupportError): count(array, axis=(0, 1))
def test_too_small(self): with self.assertRaises(ValueError): count(self.array, axis=-2)
def test_too_large(self): with self.assertRaises(ValueError): count(self.array, axis=1)
def test_none(self): with self.assertRaises(biggus.AxisSupportError): count(self.array)
def _check(self, data): array = biggus.NumpyArrayAdapter(data) result = count(array, axis=0).masked_array() expected = ma.asarray(ma.count(data, axis=0)) np.testing.assert_array_equal(result.filled(), expected) np.testing.assert_array_equal(result.mask, expected.mask)