コード例 #1
0
 def test_large(self):
     # Source data: 3 MB
     array = self._small_array()
     target = _WriteCounter(array.shape)
     with mock.patch('biggus._init.MAX_CHUNK_SIZE', 4096):
         biggus.save([array], [target])
     self.assertTrue(target.all_written())
コード例 #2
0
ファイル: test_engine.py プロジェクト: QuLogic/biggus
 def test(self):
     # If we switch evaluation engine, does it get used?
     array = _Aggregation(biggus.ConstantArray(3, 2), None, None, None, None, {})
     return_value = (mock.sentinel.result,)
     engine = mock.Mock(**{"ndarrays.return_value": return_value})
     with mock.patch("biggus.engine", engine):
         result = array.ndarray()
     self.assertIs(result, mock.sentinel.result)
コード例 #3
0
ファイル: test_engine.py プロジェクト: pombredanne/biggus
 def test(self):
     # If we switch evaluation engine, does it get used?
     array = biggus._Aggregation(biggus.ConstantArray(3, 2), None, None,
                                 None, None, {})
     return_value = (mock.sentinel.result,)
     engine = mock.Mock(**{'ndarrays.return_value': return_value})
     with mock.patch('biggus.engine', engine):
         result = array.ndarray()
     self.assertIs(result, mock.sentinel.result)
コード例 #4
0
 def _test_flow(self, axis):
     data = np.arange(3 * 4 * 5, dtype='f4').reshape(3, 4, 5)
     array = biggus.NumpyArrayAdapter(data)
     mean = biggus.mean(array, axis=axis)
     # Artificially constrain the chunk size to eight bytes to
     # ensure biggus is stepping across axes in the correct
     # order.
     with mock.patch('biggus._init.MAX_CHUNK_SIZE', 8):
         op_result, = biggus.ndarrays([mean])
     np_result = np.mean(data, axis=axis)
     np.testing.assert_array_almost_equal(op_result, np_result)
コード例 #5
0
 def test_updates_all_override_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp, 'foo')
     self.assertEqual(tmp_all, ['foo'])
コード例 #6
0
 def test_updates_all_default_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp)
     self.assertEqual(tmp_all, ['exp'])
コード例 #7
0
 def test_updates_all_override_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp, 'foo')
     self.assertEqual(tmp_all, ['foo'])
コード例 #8
0
 def test_updates_all_default_name(self):
     with mock.patch('biggus._init.__all__', []) as tmp_all:
         _ufunc_wrapper(np.exp)
     self.assertEqual(tmp_all, ['exp'])