class WordCountModifiedTests(unittest.TestCase): def setUp(self): self.wordCount = WordCountModifiedMRJob(args='-r inline'.split()) def test_mapper(self): self.assertEqual([(w,1)for w in test_document.split()], list(self.wordCount.mapper('doc_id_1', test_document))) def test_reducer(self): self.assertEqual([('foo', 2)], list(self.wordCount.reducer('foo', [1, 1]))) def test_runJob(self): jobRunOutput = list(self.wordCount.runJob(inputFileList=[log1], jobconf={'mapred.reduce.tasks':2})) self.assertEqual([(w,1)for w in sorted(test_document.split())], jobRunOutput)
class WordCountModifiedTests(unittest.TestCase): def setUp(self): self.wordCount = WordCountModifiedMRJob(args='-r inline'.split()) def test_mapper(self): self.assertEqual([(w, 1) for w in test_document.split()], list(self.wordCount.mapper('doc_id_1', test_document))) def test_reducer(self): self.assertEqual([('foo', 2)], list(self.wordCount.reducer('foo', [1, 1]))) def test_runJob(self): jobRunOutput = list( self.wordCount.runJob(inputFileList=[log1], jobconf={'mapred.reduce.tasks': 2})) self.assertEqual([(w, 1) for w in sorted(test_document.split())], jobRunOutput)
def setUp(self): self.wordCount = WordCountModifiedMRJob(args='-r inline'.split())
def setUp(self): self.wordCount = WordCountModifiedMRJob(args='-r inline'.split()) def test_mapper(self): self.assertEqual([(w,1)for w in test_document.split()], list(self.wordCount.mapper('doc_id_1', test_document)))