Exemplo n.º 1
0
 def testReducer(self):
     # This should return a reducer that computes the mean of the age
     # property on a repeated object (tests let us use a dict as a stand-in).
     r = api.apply(("reducer", ("var", "mean"), ("var", "age")))
     self.assertIsInstance(r, reducer.IReducer)
     users = repeated.meld({"name": "Mary", "age": 10},
                           {"name": "Bob", "age": 20})
     average = reducer.reduce(r, users)
     self.assertEqual(average, 15)
Exemplo n.º 2
0
 def testReducer(self):
     # This should return a reducer that computes the mean of the age
     # property on a repeated object (tests let us use a dict as a stand-in).
     r = api.apply(("reducer", ("var", "mean"), ("var", "age")))
     self.assertIsInstance(r, reducer.IReducer)
     users = repeated.meld({
         "name": "Mary",
         "age": 10
     }, {
         "name": "Bob",
         "age": 20
     })
     average = reducer.reduce(r, users)
     self.assertEqual(average, 15)
Exemplo n.º 3
0
 def __call__(self, data, chunk_size=None):
     return reducer.reduce(self, data, chunk_size)
Exemplo n.º 4
0
Arquivo: core.py Projeto: Onager/dotty
 def __call__(self, data, chunk_size=None):
     return reducer.reduce(self, data, chunk_size)