def test_map_reduce(self): rapmedusa.map_reduce(self.conn, self.mapFn, self.reduceFn, self.inKey, self.sortKey, self.sortedKeySet, self.outKey, False) # after creating buckets according to map output keys, does the # result match what we expect? self.assertEquals(getMapReduceManager().getMappedVals(), {'mr_sort:green': ['1', '1', '1'], 'mr_sort:red': ['1'], 'mr_sort:blue': ['1']}) # check the outputs after running the reduce function self.assertEquals(getMapReduceManager().getOutput(), {'blue': '1', 'red': '1', 'green': '3'})
def tearDown(self): self.conn.delete(self.inKey) getMapReduceManager().cleanUp() self.conn.delete(self.outKey)