Exemple #1
0
    def test_htmlhelp(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        mg = MagicFile()
        mg.add_context(
            {"file_tail": file_tail, "Database": Database, "text": 3})
        cmd = "-np -f rawhtml file_tail"
        res = mg.hhelp(cmd)
        assert "<p>extracts the first nbline of a file " in res
        res = mg.hhelp("-np -f rst file_tail")
        assert ":param      threshold:" in res
        res = mg.hhelp("-np -f rawhtml Database")
        assert "SQL file which can be empty or not," in res
        doc = docstring2html(Database.__init__, format="rawhtml")
        assert "it can also contain several files separated by" in doc
        fLOG("----------")
        res = mg.hhelp("-np -f rst Database.__init__")
        assert "it can also contain several files separated by" in res
        res = mg.hhelp("Database.__init__")
        assert res is not None
        res = mg.hhelp("-np -f text Database.__init__")
        assert "it can also contain several files separated by" in res
        assert "@param" in res
Exemple #2
0
    def hhelp(self, line):
        """
        define ``%hhelp``, it displays the help for an object in HTML

        .. versionadded:: 1.1
        """
        parser = self.get_parser(MagicFile.hhelp_parser, "hhelp")
        args = self.get_args(line, parser)

        if args is not None:
            obj = args.obj
            format = args.format
            nop = args.no_print
            if nop or format == "html":
                return docstring2html(obj, format=format)
            else:
                print(docstring2html(obj, format=format))