changeset 42:1b6fc390ffc7

Normalized whitespace on doctests.
author Atul Varma <varmaa@toolness.com>
date Fri, 06 Jun 2008 13:36:40 -0700
parents af7d50fc8cfd
children 2a9697cc9e55
files Makefile PythonForJsProgrammers.html PythonForJsProgrammers.txt
diffstat 3 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jun 06 13:20:37 2008 -0700
+++ b/Makefile	Fri Jun 06 13:36:40 2008 -0700
@@ -2,4 +2,4 @@
 	rst2html.py --stylesheet-path=PythonForJsProgrammers.css --link-stylesheet PythonForJsProgrammers.txt > PythonForJsProgrammers.html
 
 test:
-	python -c "import doctest; doctest.testfile('PythonForJsProgrammers.txt')"
+	python -c "import doctest; doctest.testfile('PythonForJsProgrammers.txt', optionflags=doctest.NORMALIZE_WHITESPACE)"
--- a/PythonForJsProgrammers.html	Fri Jun 06 13:20:37 2008 -0700
+++ b/PythonForJsProgrammers.html	Fri Jun 06 13:36:40 2008 -0700
@@ -104,7 +104,18 @@
 <blockquote>
 <pre class="doctest-block">
 &gt;&gt;&gt; dir(&quot;a string&quot;)
-['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
+['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
+ '__eq__', '__ge__', '__getattribute__', '__getitem__',
+ '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
+ '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__',
+ '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__',
+ '__rmul__', '__setattr__', '__str__', 'capitalize', 'center',
+ 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find',
+ 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace',
+ 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip',
+ 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition',
+ 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip',
+ 'swapcase', 'title', 'translate', 'upper', 'zfill']
 </pre>
 </blockquote>
 <p>If there's a function you're interested in learning more about, you
@@ -767,7 +778,8 @@
 &gt;&gt;&gt; u&quot;hello\u2026&quot;.encode(&quot;ascii&quot;)
 Traceback (most recent call last):
 ...
-UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 5: ordinal not in range(128)
+UnicodeEncodeError: 'ascii' codec can't encode character
+u'\u2026' in position 5: ordinal not in range(128)
 </pre>
 </blockquote>
 <p>As such, it's a good idea to optionally specify an algorithm to deal
--- a/PythonForJsProgrammers.txt	Fri Jun 06 13:20:37 2008 -0700
+++ b/PythonForJsProgrammers.txt	Fri Jun 06 13:36:40 2008 -0700
@@ -106,7 +106,18 @@
 attributes attached to an object:
 
     >>> dir("a string")
-    ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
+    ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
+     '__eq__', '__ge__', '__getattribute__', '__getitem__',
+     '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
+     '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__',
+     '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__',
+     '__rmul__', '__setattr__', '__str__', 'capitalize', 'center',
+     'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find',
+     'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace',
+     'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip',
+     'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition',
+     'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip',
+     'swapcase', 'title', 'translate', 'upper', 'zfill']
 
 If there's a function you're interested in learning more about, you
 can look at the built-in documentation metadata associated with the
@@ -711,7 +722,8 @@
     >>> u"hello\u2026".encode("ascii")
     Traceback (most recent call last):
     ...
-    UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 5: ordinal not in range(128)
+    UnicodeEncodeError: 'ascii' codec can't encode character
+    u'\u2026' in position 5: ordinal not in range(128)
 
 As such, it's a good idea to optionally specify an algorithm to deal
 with characters that aren't supported by the encoding: