예제 #1
0
 def get_help(self):
     """Return the detailed help about the "help" command options and usage."""
     return (
         PF.title("Help command manual") + PF.section("Description") +
         PF.paragraph(self.description) + PF.section("Synopsis") +
         PF.paragraph(Color.BOLD + "./orchid help [COMMAND]" + Color.END) +
         PF.section("Description") + PF.paragraph(
             "With no " + Color.BOLD + "COMMAND" + Color.END +
             " specified, print available commands on the standard output.")
         + PF.paragraph(
             "If " + Color.BOLD + "COMMAND" + Color.END +
             " is specified and exists, print the help manual of the command on the standard output."
         ))
 def test_paragraph_line_breaks(self):
     """Test that the result begins and ends with a line break"""
     test_str = "test str"
     formatted_str = PrintFormatter.paragraph(test_str)
     str_length = len(formatted_str)
     self.assertTrue(str_length > 2)
     self.assertEqual(formatted_str[0], '\n')
     self.assertEqual(formatted_str[str_length - 1], '\n')
 def test_paragraph_preserves_capitalization(self):
     """Test that capitalization is preserved"""
     test_str = "tEst brOKen str"
     formatted_str = PrintFormatter.paragraph(test_str)
     str_length = len(formatted_str)
     self.assertEqual(formatted_str, "\n    tEst brOKen str\n")
 def test_paragraph_removes_internal_line_breaks(self):
     """Test that inner line breaks are replaced by spaces"""
     test_str = "test\nbroken\nstr"
     formatted_str = PrintFormatter.paragraph(test_str)
     str_length = len(formatted_str)
     self.assertEqual(formatted_str, "\n    test broken str\n")
 def test_paragraph_containing_formatting(self):
     """Test that internal formatting marks are preserved"""
     test_str = "test " + Color.BOLD + "bold" + Color.END + " str"
     formatted_str = PrintFormatter.paragraph(test_str)
     self.assertEqual(formatted_str, "\n    test \033[1mbold\033[0m str\n")
 def test_paragraph_empty_string(self):
     """Test that the result is an empty string for an empty string"""
     test_str = ""
     formatted_str = PrintFormatter.paragraph(test_str)
     self.assertEqual(formatted_str, "")
 def test_paragraph_is_indented(self):
     """Test that the result format is properly indented"""
     test_str = "test str"
     formatted_str = PrintFormatter.paragraph(test_str)
     str_length = len(formatted_str)
     self.assertEqual(formatted_str, "\n    test str\n")