Beispiel #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"),
        )
Beispiel #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"),
        )
Beispiel #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"),
        )
Beispiel #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"),
        )
Beispiel #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"),
        )
Beispiel #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"),
        )