def test_unsupported_mdtol(self): # The VARIANCE aggregator supports lazy_aggregation but does # not provide mdtol handling. Check that a TypeError is raised # if this unsupported kwarg is specified. array = biggus.NumpyArrayAdapter(np.arange(8)) msg = "unexpected keyword argument 'mdtol'" with self.assertRaisesRegexp(TypeError, msg): VARIANCE.lazy_aggregate(array, axis=0, mdtol=0.8)
def test(self): self.assertIsNotNone(VARIANCE.units_func) mul = mock.Mock(return_value=mock.sentinel.new_unit) units = mock.Mock(__mul__=mul) new_units = VARIANCE.units_func(units) # Make sure the VARIANCE units_func tries to square the units. mul.assert_called_once_with(units) self.assertEqual(new_units, mock.sentinel.new_unit)
def test_ddof_zero(self): array = biggus.NumpyArrayAdapter(np.arange(8)) var = VARIANCE.lazy_aggregate(array, axis=0, ddof=0) self.assertArrayAlmostEqual(var.ndarray(), np.array(5.25))
def test(self): shape = () kwargs = dict() self.assertTupleEqual(VARIANCE.aggregate_shape(**kwargs), shape) kwargs = dict(bat='man', wonder='woman') self.assertTupleEqual(VARIANCE.aggregate_shape(**kwargs), shape)
def test(self): self.assertEqual(VARIANCE.name(), 'variance')
def test_ddof_zero(self): array = as_lazy_data(np.arange(8)) var = VARIANCE.lazy_aggregate(array, axis=0, ddof=0) result = as_concrete_data(var) self.assertArrayAlmostEqual(result, np.array(5.25))