aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2014-03-10 22:05:42 +0100
committerMartin Vilcans <martin@librador.com>2014-03-10 22:05:42 +0100
commit436c6c702bedbce65936fb0d8eab09053015de61 (patch)
treea2e16226495d1865c2b6f81a1f49ee24d709edd6
parentb0588ec991411611013b22fe7cfbb78c902b14e3 (diff)
downloadscreenplain-436c6c702bedbce65936fb0d8eab09053015de61.tar.gz
Make some doctests compatible with Python 3.
In Py3, sys.stdout.write returns a value, which caused different output in doctests.
-rw-r--r--screenplain/export/html.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/screenplain/export/html.py b/screenplain/export/html.py
index b987d81..6f1d11d 100644
--- a/screenplain/export/html.py
+++ b/screenplain/export/html.py
@@ -21,19 +21,22 @@ class tag(object):
>>> import sys
>>> from __future__ import with_statement
>>> with tag(sys.stdout, 'div'):
- ... sys.stdout.write('hello')
+ ... print('hello')
...
- <div>hello</div>
+ <div>hello
+ </div>
Adding classes to the element is possible:
>>> with tag(sys.stdout, 'div', classes=['action']):
- ... sys.stdout.write('hello')
- <div class="action">hello</div>
+ ... print('hello')
+ <div class="action">hello
+ </div>
>>> with tag(sys.stdout, 'div', classes=['action', 'centered']):
- ... sys.stdout.write('hello')
- <div class="action centered">hello</div>
+ ... print('hello')
+ <div class="action centered">hello
+ </div>
"""
def __init__(self, out, tag, classes=None):