Exemple #1
0
 def test_wrap_long_string(self):
     """
     Tests for the wrap_long_string() function.
     """
     string = ("Retrieve an event based on the unique origin "
               "ID numbers assigned by the IRIS DMC")
     got = wrap_long_string(string, prefix="\t*\t > ", line_length=50)
     expected = ("\t*\t > Retrieve an event based on\n"
                 "\t*\t > the unique origin ID numbers\n"
                 "\t*\t > assigned by the IRIS DMC")
     self.assertEqual(got, expected)
     got = wrap_long_string(string, prefix="\t* ", line_length=70)
     expected = ("\t* Retrieve an event based on the unique origin ID\n"
                 "\t* numbers assigned by the IRIS DMC")
     got = wrap_long_string(string, prefix="\t \t  > ",
                            special_first_prefix="\t*\t", line_length=50)
     expected = ("\t*\tRetrieve an event based on\n"
                 "\t \t  > the unique origin ID numbers\n"
                 "\t \t  > assigned by the IRIS DMC")
     problem_string = ("Retrieve_an_event_based_on_the_unique "
                       "origin ID numbers assigned by the IRIS DMC")
     got = wrap_long_string(problem_string, prefix="\t\t", line_length=40,
                            sloppy=True)
     expected = ("\t\tRetrieve_an_event_based_on_the_unique\n"
                 "\t\torigin ID\n"
                 "\t\tnumbers\n"
                 "\t\tassigned by\n"
                 "\t\tthe IRIS DMC")
     got = wrap_long_string(problem_string, prefix="\t\t", line_length=40)
     expected = ("\t\tRetrieve_an_event_base\\\n"
                 "\t\td_on_the_unique origin\n"
                 "\t\tID numbers assigned by\n"
                 "\t\tthe IRIS DMC")
Exemple #2
0
 def test_wrap_long_string(self):
     """
     Tests for the wrap_long_string() function.
     """
     string = ("Retrieve an event based on the unique origin "
               "ID numbers assigned by the IRIS DMC")
     got = wrap_long_string(string, prefix="\t*\t > ", line_length=50)
     expected = ("\t*\t > Retrieve an event based on\n"
                 "\t*\t > the unique origin ID numbers\n"
                 "\t*\t > assigned by the IRIS DMC")
     self.assertEqual(got, expected)
     got = wrap_long_string(string, prefix="\t* ", line_length=70)
     expected = ("\t* Retrieve an event based on the unique origin ID\n"
                 "\t* numbers assigned by the IRIS DMC")
     got = wrap_long_string(string,
                            prefix="\t \t  > ",
                            special_first_prefix="\t*\t",
                            line_length=50)
     expected = ("\t*\tRetrieve an event based on\n"
                 "\t \t  > the unique origin ID numbers\n"
                 "\t \t  > assigned by the IRIS DMC")
     problem_string = ("Retrieve_an_event_based_on_the_unique "
                       "origin ID numbers assigned by the IRIS DMC")
     got = wrap_long_string(problem_string,
                            prefix="\t\t",
                            line_length=40,
                            sloppy=True)
     expected = ("\t\tRetrieve_an_event_based_on_the_unique\n"
                 "\t\torigin ID\n"
                 "\t\tnumbers\n"
                 "\t\tassigned by\n"
                 "\t\tthe IRIS DMC")
     got = wrap_long_string(problem_string, prefix="\t\t", line_length=40)
     expected = ("\t\tRetrieve_an_event_base\\\n"
                 "\t\td_on_the_unique origin\n"
                 "\t\tID numbers assigned by\n"
                 "\t\tthe IRIS DMC")
Exemple #3
0
            def _param_info_string(name):
                param = self.services[service][name]
                name = "%s (%s)" % (name, param["type"].__name__)
                req_def = ""
                if param["required"]:
                    req_def = "Required Parameter"
                elif param["default_value"]:
                    req_def = "Default value: %s" % str(param["default_value"])
                if param["options"]:
                    req_def += ", Choices: %s" % \
                        ", ".join(map(str, param["options"]))
                if req_def:
                    req_def = ", %s" % req_def
                if param["doc_title"]:
                    doc_title = wrap_long_string(param["doc_title"],
                                                 prefix="        ")
                    doc_title = "\n" + doc_title
                else:
                    doc_title = ""

                return "    {name}{req_def}{doc_title}".format(
                    name=name, req_def=req_def, doc_title=doc_title)
Exemple #4
0
            def _param_info_string(name):
                param = self.services[service][name]
                name = "%s (%s)" % (name, param["type"].__name__)
                req_def = ""
                if param["required"]:
                    req_def = "Required Parameter"
                elif param["default_value"]:
                    req_def = "Default value: %s" % str(param["default_value"])
                if param["options"]:
                    req_def += ", Choices: %s" % \
                        ", ".join(map(str, param["options"]))
                if req_def:
                    req_def = ", %s" % req_def
                if param["doc_title"]:
                    doc_title = wrap_long_string(param["doc_title"],
                                                 prefix="        ")
                    doc_title = "\n" + doc_title
                else:
                    doc_title = ""

                return "    {name}{req_def}{doc_title}".format(
                    name=name, req_def=req_def, doc_title=doc_title)