示例#1
0
    def test_empty_002(self):
        """Add to the end of an empty `help` attribute."""
        help_ = ""

        self.assertEqual(
            [["foo", "bar"]],
            url_help.insert_help_entry(help_, "foo", "bar"),
        )
示例#2
0
    def test_end_string(self):
        """Add to the end of a string `help` attribute."""
        help_ = "something"

        self.assertEqual(
            [["Home Page", "something"], ["foo", "bar"]],
            url_help.insert_help_entry(help_, "foo", "bar"),
        )
示例#3
0
    def test_beginning_string(self):
        """Add to the beginning of a string `help` attribute."""
        help_ = "something"

        self.assertEqual(
            [["AAA", "zzz"], ["Home Page", "something"]],
            url_help.insert_help_entry(help_, "AAA", "zzz"),
        )
示例#4
0
    def test_undefined(self):
        """Define a new `help` attribute."""
        folder = tempfile.mkdtemp(suffix="_InsertHelpEntry_test_undefined")
        atexit.register(functools.partial(shutil.rmtree, folder))

        with open(os.path.join(folder, "package.py"), "w") as handler:
            handler.write('name = "some_package"')

        package = packages_.get_developer_package(folder)

        self.assertEqual(
            [["foo", "bar"]],
            url_help.insert_help_entry(package.help, "foo", "bar"),
        )
示例#5
0
    def test_middle_list(self):
        """Add to the middle of a list `help` attribute."""
        help_ = [
            ["another", "thing"],
            ["blah", "something"],
        ]

        self.assertEqual(
            [
                ["another", "thing"],
                ["azz", "zzz"],
                ["blah", "something"],
            ],
            url_help.insert_help_entry(help_, "azz", "zzz"),
        )
示例#6
0
    def test_end_list(self):
        """Add to the end of a list `help` attribute."""
        help_ = [
            ["another", "thing"],
            ["blah", "something"],
        ]

        self.assertEqual(
            [
                ["another", "thing"],
                ["blah", "something"],
                ["foo", "bar"],
            ],
            url_help.insert_help_entry(help_, "foo", "bar"),
        )