Exemplo n.º 1
0
    def test_local_end_to_end(self):

        os.system("cp data/test/*.txt %s" % Config.input_path)
        worker = Worker()
        worker.process_input()
        master = Master(['.'])
        master.synch_all_workers()
        master.tally()
        output1 = master.output()
        expected_output1 = '''the: 56510
and: 37915
to: 27984
of: 27884
a: 22899
i: 22159
in: 17366
it: 15182
that: 14578
was: 13184
'''
        self.assertEqual(output1, expected_output1,
                         'End to End output1 not as expected')

        uri = 'http://www.constitution.org/usdeclar.txt'
        worker.injest(uri)
        worker.process_input()
        master.synch_all_workers()
        master.tally()
        output2 = master.output()
        expected_output2 = '''the: 56588
and: 37972
to: 28049
of: 27964
a: 22914
i: 22159
in: 17387
it: 15188
that: 14591
was: 13184
'''
        self.assertEqual(output2, expected_output2,
                         'End to End output2 not as expected')