Skip to content
Permalink
Browse files

fix unit test

  • Loading branch information...
sdpython committed Aug 25, 2017
1 parent d9f5b98 commit 59b39b48fee70ce6aa3891cec6abdd78d9c0c99a
@@ -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"
]
},
{
@@ -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")
@@ -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:
@@ -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__":
@@ -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:

0 comments on commit 59b39b4

Please sign in to comment.
You can’t perform that action at this time.