def testHelpScreen(self): component = tc.ClassWithDocstring() t = trace.FireTrace(component, name='ClassWithDocstring') info = inspectutils.Info(component) info['docstring_info'] = docstrings.parse(info['docstring']) help_output = helptext.HelpText(component, info, t) expected_output = """ NAME ClassWithDocstring - Test class for testing help text output. SYNOPSIS ClassWithDocstring COMMAND | VALUES DESCRIPTION This is some detail description of this test class. COMMANDS COMMAND is one of the followings: print_msg Prints a message. VALUES VALUE is one of the followings: message The default message to print. """ self.assertEqual(textwrap.dedent(expected_output).lstrip('\n'), help_output)
def testHelpScreen(self): component = tc.ClassWithDocstring() t = trace.FireTrace(component, name='ClassWithDocstring') help_output = helptext.HelpText(component, t) expected_output = """ NAME ClassWithDocstring - Test class for testing help text output. SYNOPSIS ClassWithDocstring COMMAND | VALUE DESCRIPTION This is some detail description of this test class. COMMANDS COMMAND is one of the following: print_msg Prints a message. VALUES VALUE is one of the following: message The default message to print.""" self.assertEqual( textwrap.dedent(expected_output).strip(), help_output.strip())
def testHelpTextBoldCommandName(self): component = tc.ClassWithDocstring() t = trace.FireTrace(component, name='ClassWithDocstring') help_screen = helptext.HelpText(component, t) self.assertIn( formatting.Bold('NAME') + '\n ClassWithDocstring', help_screen) self.assertIn(formatting.Bold('COMMANDS') + '\n', help_screen) self.assertIn( formatting.BoldUnderline('COMMAND') + ' is one of the following:\n', help_screen) self.assertIn(formatting.Bold('print_msg') + '\n', help_screen)
def testHelpTextBoldCommandName(self): component = tc.ClassWithDocstring() t = trace.FireTrace(component, name="ClassWithDocstring") help_screen = helptext.HelpText(component, t) self.assertIn(formatting.Bold("NAME") + "\n ClassWithDocstring", help_screen) self.assertIn(formatting.Bold("COMMANDS") + "\n", help_screen) self.assertIn( formatting.BoldUnderline("COMMAND") + " is one of the following:\n", help_screen, ) self.assertIn(formatting.Bold("print_msg") + "\n", help_screen)