예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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))
예제 #6
0
 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)
예제 #7
0
 def test(self):
     self.assertEqual(VARIANCE.name(), 'variance')
예제 #8
0
 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))
예제 #9
0
 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))
예제 #10
0
 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)
예제 #11
0
 def test(self):
     self.assertEqual(VARIANCE.name(), 'variance')