def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( "origin", "message", additional_info="A lot of additional information can be found here" )
def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( 'origin', 'message', additional_info='A lot of additional information can be found here' )
class PrintMoreInfoActionTest(unittest.TestCase): def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( 'origin', 'message', additional_info='A lot of additional information can be found here') def test_is_applicable(self): with self.assertRaises(TypeError): self.uut.is_applicable(1, None, None) self.assertEqual( self.uut.is_applicable(Result('o', 'm'), None, None), 'There is no additional info.' ) self.assertTrue(self.uut.is_applicable(self.test_result, None, None)) def test_apply(self): with retrieve_stdout() as stdout: self.assertEqual(self.uut.apply_from_section(self.test_result, {}, {}, Section('name')), {}) self.assertEqual(stdout.getvalue(), self.test_result.additional_info + '\n')
def provide_all_actions(): return [DoNothingAction().get_metadata().desc, ShowPatchAction().get_metadata().desc, ApplyPatchAction().get_metadata().desc, IgnoreResultAction().get_metadata().desc, OpenEditorAction().get_metadata().desc, PrintAspectAction().get_metadata().desc, PrintDebugMessageAction().get_metadata().desc, PrintMoreInfoAction().get_metadata().desc]
class PrintMoreInfoActionTest(unittest.TestCase): def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( 'origin', 'message', additional_info='A lot of additional information can be found here' ) def test_is_applicable(self): self.assertFalse(self.uut.is_applicable(1, None, None)) self.assertFalse(self.uut.is_applicable(Result('o', 'm'), None, None)) self.assertTrue(self.uut.is_applicable(self.test_result, None, None)) def test_apply(self): with retrieve_stdout() as stdout: self.assertEqual( self.uut.apply_from_section(self.test_result, {}, {}, Section('name')), {}) self.assertEqual(stdout.getvalue(), self.test_result.additional_info + '\n')
class PrintMoreInfoActionTest(unittest.TestCase): def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( "origin", "message", additional_info="A lot of additional information can be found here") def test_is_applicable(self): self.assertFalse(self.uut.is_applicable(1, None, None)) self.assertFalse(self.uut.is_applicable(Result("o", "m"), None, None)) self.assertTrue(self.uut.is_applicable(self.test_result, None, None)) def test_apply(self): with retrieve_stdout() as stdout: self.assertEqual(self.uut.apply_from_section(self.test_result, {}, {}, Section("name")), {}) self.assertEqual(stdout.getvalue(), self.test_result.additional_info + "\n")
'cannot be printed because it refers to a line ' "that doesn't seem to exist in the given file.") STR_PROJECT_WIDE = 'Project wide:' STR_ENTER_NUMBER = ('Enter number (Ctrl-' f"{'Z' if platform.system() == 'Windows' else 'D'} " 'to exit): ') STR_INVALID_OPTION = '*** Invalid Option: ({}) ***\n' WARNING_COLOR = 'red' FILE_NAME_COLOR = 'blue' FILE_LINES_COLOR = 'blue' CAPABILITY_COLOR = 'green' HIGHLIGHTED_CODE_COLOR = 'red' SUCCESS_COLOR = 'green' REQUIRED_SETTINGS_COLOR = 'green' CLI_ACTIONS = (OpenEditorAction(), ApplyPatchAction(), PrintDebugMessageAction(), PrintMoreInfoAction(), ShowPatchAction(), IgnoreResultAction(), ShowAppliedPatchesAction(), GeneratePatchesAction()) DIFF_EXCERPT_MAX_SIZE = 4 def color_letter(console_printer, line): x = line.find('(') if x == -1: letter = '' y = x + 1 else: letter = line[x + 1] y = x + 2 warn = line.rfind('[') if warn == 0:
STR_LINE_DOESNT_EXIST = ('The line belonging to the following result ' 'cannot be printed because it refers to a line ' "that doesn't seem to exist in the given file.") STR_PROJECT_WIDE = 'Project wide:' STR_ENTER_NUMBER = 'Enter number (Ctrl-{} to exit): '.format( 'Z' if platform.system() == 'Windows' else 'D') FILE_NAME_COLOR = 'blue' FILE_LINES_COLOR = 'blue' CAPABILITY_COLOR = 'green' HIGHLIGHTED_CODE_COLOR = 'red' SUCCESS_COLOR = 'green' REQUIRED_SETTINGS_COLOR = 'green' CLI_ACTIONS = (OpenEditorAction(), ApplyPatchAction(), PrintDebugMessageAction(), PrintMoreInfoAction(), ShowPatchAction(), IgnoreResultAction(), ShowAppliedPatchesAction(), GeneratePatchesAction()) DIFF_EXCERPT_MAX_SIZE = 4 def color_letter(console_printer, line): x = -1 y = -1 letter = '' for i, l in enumerate(line, 0): if line[i] == '(': x = i if line[i] == ')':
def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( 'origin', 'message', additional_info='A lot of additional information can be found here')
def setUp(self): self.uut = PrintMoreInfoAction() self.test_result = Result( "origin", "message", additional_info="A lot of additional information can be found here")