summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2019-02-21 20:26:47 +0100
committerGitHub <noreply@github.com>2019-02-21 20:26:47 +0100
commitc088581f5ed882554d1e27074411b2c874955010 (patch)
tree0a354ecf213d5a75aac23c890ec92b148896553e /test.py
parentd9eb1a980798ff54ac9cd81ff1821f78aa57156b (diff)
parent69c11fb0aa1750225d1f9549474554bb1d3eb932 (diff)
Merge pull request #46 from jpyams/python3
Add Python 3 support
Diffstat (limited to 'test.py')
-rw-r--r--test.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..c4e5887
--- /dev/null
+++ b/test.py
@@ -0,0 +1,24 @@
+"""Runs nosetest after preparing the test cases.
+
+Removes the leading u from unicode literals so
+Python 3 doctests won't fail.
+
+"""
+
+from screenplain import richstring
+import re
+
+unicode_literal = re.compile(r'u([\'"])')
+
+for n in (
+ 'parse_emphasis',
+ '_unescape',
+ '_demagic_literals',
+):
+ attr = getattr(richstring, n)
+ old_doc = getattr(attr, '__doc__')
+ new_doc = unicode_literal.sub(r'\1', old_doc)
+ setattr(attr, '__doc__', new_doc)
+
+import nose
+nose.main(argv='nosetests --nocapture --with-doctest --doctest-tests'.split())