diff --git a/_doc/notebooks/git_dataframes.ipynb b/_doc/notebooks/git_dataframes.ipynb index 8d8f85c15..9c4d09dae 100644 --- a/_doc/notebooks/git_dataframes.ipynb +++ b/_doc/notebooks/git_dataframes.ipynb @@ -184,7 +184,7 @@ ], "source": [ "from gitpandas import Repository\n", - "tries = [\"../..\", \"../../..\"]\n", + "tries = [\"../..\", \"../../..\", \"../../../..\"]\n", "err = None\n", "for t in tries:\n", " try:\n", @@ -194,7 +194,7 @@ " err = e\n", " continue\n", "if err is not None:\n", - " raise e" + " raise err" ] }, { diff --git a/_unittests/ut_helpgen/test_changes.py b/_unittests/ut_helpgen/test_changes.py index 414baf8ec..202c1efa7 100644 --- a/_unittests/ut_helpgen/test_changes.py +++ b/_unittests/ut_helpgen/test_changes.py @@ -56,13 +56,11 @@ def modifiy_commit(nbch, date, author, comment): generate_changes_repo(file, fold) with open(file, "r", encoding="utf8") as f: content = f.read() - assert ".. plot::" in content + self.assertIn(".. plot::", content) content = content[ - content.find("List of recent changes:"):].split("\n") - ls = [len(_) for _ in content] - ml = max(ls) - total = [l for l in ls if ml - 100 <= l < ml] - assert len(ls) > 0 and len(total) == 0 + content.find("List of recent changes:"):] + self.assertTrue(len(content) > 0) + self.assertIn(":widths: auto", content) else: fLOG( "sorry, fixing a specific case on another project for accent problem") diff --git a/_unittests/ut_helpgen/test_doxygen2rst.py b/_unittests/ut_helpgen/test_doxygen2rst.py index d1aacbc0d..3715a23eb 100644 --- a/_unittests/ut_helpgen/test_doxygen2rst.py +++ b/_unittests/ut_helpgen/test_doxygen2rst.py @@ -81,11 +81,14 @@ def test_process_var_tag(self): exp = """ This is the documentation for this class. - +-----------+-----------------------------+ - | attribute | meaning | - +===========+=============================+ - | pa | an example of an attribute. | - +-----------+-----------------------------+ + .. list-table:: + :widths: auto + :header-rows: 1 + + * - attribute + - meaning + * - pa + - an example of an attribute. Inline :math:`x^2 + y + z`. Another equation to test: diff --git a/_unittests/ut_helpgen/test_utils_sphinxdocmain.py b/_unittests/ut_helpgen/test_utils_sphinxdocmain.py index 7c9feaf87..b96a554ec 100644 --- a/_unittests/ut_helpgen/test_utils_sphinxdocmain.py +++ b/_unittests/ut_helpgen/test_utils_sphinxdocmain.py @@ -34,19 +34,19 @@ def test_sphinx_changes(self): OutputPrint=__name__ == "__main__") path = os.path.abspath(os.path.split(__file__)[0]) file = os.path.normpath(os.path.join(path, "..", "..")) - assert os.path.exists(file) - fLOG(file) + self.assertTrue(os.path.exists(file)) if sys.version_info[0] == 2: return rst = generate_changes_repo(None, file) - fLOG(rst) - assert len(rst) > 0 - if "+-----------------------" not in rst: - raise Exception( - "+----------------------- not in rst:\n" + - str(rst)) + # fLOG(rst[:5000]) + self.assertTrue(len(rst) > 0) + self.assertIn(".. list-table::", rst) + self.assertIn("* - #", rst) + self.assertIn("* - 2138", rst) + self.assertIn("- 2017-08-25", rst) + self.assertIn("- catch zip extension", rst) if __name__ == "__main__": diff --git a/src/pyquickhelper/pandashelper/tblformat.py b/src/pyquickhelper/pandashelper/tblformat.py index 2299f7cbf..d0611931a 100644 --- a/src/pyquickhelper/pandashelper/tblformat.py +++ b/src/pyquickhelper/pandashelper/tblformat.py @@ -92,7 +92,7 @@ def complete(cool): s = "" else: s = typstr(s) - return s + return (" " + s) if s else s else: i, s = cool if s is None: @@ -108,10 +108,11 @@ def complete(cool): if list_table: def format_on_row(row): - one = "\n - ".join(map(complete, enumerate(row))) - return " * - " + one + one = "\n -".join(map(complete, enumerate(row))) + res = " * -" + one + return res - rows = [".. list-table:: {0}".format(title if title else "")] + rows = [".. list-table:: {0}".format(title if title else "").strip()] if column_size is None: rows.append(" :widths: auto") else: