From 436c6c702bedbce65936fb0d8eab09053015de61 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Mon, 10 Mar 2014 22:05:42 +0100 Subject: Make some doctests compatible with Python 3. In Py3, sys.stdout.write returns a value, which caused different output in doctests. --- screenplain/export/html.py | 15 +++++++++------ 1 file 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') ... -
hello
+
hello +
Adding classes to the element is possible: >>> with tag(sys.stdout, 'div', classes=['action']): - ... sys.stdout.write('hello') -
hello
+ ... print('hello') +
hello +
>>> with tag(sys.stdout, 'div', classes=['action', 'centered']): - ... sys.stdout.write('hello') -
hello
+ ... print('hello') +
hello +
""" def __init__(self, out, tag, classes=None): -- cgit