def test_process_one_doc__deals_with_analyzer_errors(self): mock_analyzers = [ get_mock_analyzer('one', '+'), get_mock_analyzer('two', (None, 'Some error msg')), get_mock_analyzer('three', '0'), ] exp_results = ['+', 'Error', '0'] with patch('compare.ANALYZERS', mock_analyzers), patch('compare.LOGGER'): act_results = process_one_doc("some text", "+")[0] self.assertEqual(act_results, exp_results)
def test_process_one_doc(self): mock_analyzers = [ get_mock_analyzer('one', '+'), get_mock_analyzer('two', '-'), get_mock_analyzer('three', '0'), ] exp_results = ['+', '-', '0'] exp_accuracy = {'one': 1} exp_error_rate = {'two': 2, 'three': 1} with patch('compare.ANALYZERS', mock_analyzers), patch('compare.LOGGER'): act_results, act_accuracy, act_error_rate = process_one_doc("some text", "+") self.assertEqual(act_results, exp_results) self.assertEqual(sorted(act_accuracy.items()), sorted(exp_accuracy.items())) self.assertEqual(sorted(act_error_rate.items()), sorted(exp_error_rate.items()))
def test_process_one_doc(self): mock_analyzers = [ get_mock_analyzer('one', '+'), get_mock_analyzer('two', '-'), get_mock_analyzer('three', '0'), ] exp_results = ['+', '-', '0'] exp_accuracy = {'one': 1} exp_error_rate = {'two': 2, 'three': 1} with patch('compare.ANALYZERS', mock_analyzers), patch('compare.LOGGER'): act_results, act_accuracy, act_error_rate = process_one_doc( "some text", "+") self.assertEqual(act_results, exp_results) self.assertEqual(sorted(act_accuracy.items()), sorted(exp_accuracy.items())) self.assertEqual(sorted(act_error_rate.items()), sorted(exp_error_rate.items()))