summaryrefslogtreecommitdiff
path: root/tests/wikitest.py
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-08-16 15:45:00 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-08-17 13:17:11 +0300
commit7186dbab7f1c1227e9229866e086bc417e3e4e52 (patch)
treef29114e9ff7a7b023dd3d611a9bc8808f5cf5bbd /tests/wikitest.py
parentd9e26129527ce84f626eb44ff95e4ecfbc5bc92a (diff)
downloadwikitrans-7186dbab7f1c1227e9229866e086bc417e3e4e52.tar.gz
wikitrans-7186dbab7f1c1227e9229866e086bc417e3e4e52.tar.bz2
Fix PEP 8 issues.
Diffstat (limited to 'tests/wikitest.py')
-rw-r--r--tests/wikitest.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/wikitest.py b/tests/wikitest.py
new file mode 100644
index 0000000..ff26227
--- /dev/null
+++ b/tests/wikitest.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+from __future__ import print_function
+from glob import glob
+import os.path
+
+def wiki_markup_test(classname, name_in, name_out):
+ fh = open(name_out)
+ buf = ''.join(fh.readlines()).strip()
+ fh.close()
+ hwm = classname(filename=name_in, lang="en")
+ hwm.parse()
+
+ if str(hwm).strip() == buf:
+ return True
+
+ # fail
+ print("\n>>>%s<<<" % buf)
+ print(">>>%s<<<" % str(hwm).strip())
+ return False
+
+def populate_methods(cls, wcls, suffix):
+ def settest(self, base, wiki_name, pat_name):
+ def dyntest(self):
+ self.assertTrue(wiki_markup_test(wcls, wiki_name, pat_name))
+ meth = 'test_' + wcls.__name__ + '_' + base
+ dyntest.__name__ = meth
+ setattr(cls, meth, dyntest)
+ for file in glob('testdata/*.wiki'):
+ if os.path.isfile(file):
+ patfile = file[:len(file) - 5] + suffix
+ base, ext = os.path.splitext(os.path.basename(file))
+ if os.path.exists(patfile) and os.path.isfile(patfile):
+ settest(cls, base, file, patfile)

Return to:

Send suggestions and report system problems to the System administrator.