-from test.test_support import verbose, findfile
+from test.test_support import verbose, findfile, TestFailed
import tokenize, os, sys
if verbose:
if verbose:
print 'finished'
+
+###### Test detecton of IndentationError ######################
+
+from cStringIO import StringIO
+
+sampleBadText = """
+def foo():
+ bar
+ baz
+"""
+
+try:
+ for tok in tokenize.generate_tokens(StringIO(sampleBadText).readline):
+ pass
+except IndentationError:
+ pass
+else:
+ raise TestFailed("Did not detect IndentationError:")
indents.append(column)
yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line)
while column < indents[-1]:
+ if column not in indents:
+ raise IndentationError(
+ "unindent does not match any outer indentation level")
indents = indents[:-1]
yield (DEDENT, '', (lnum, pos), (lnum, pos), line)
Library
-------
+- Bug #1224621: tokenize module does not detect inconsistent dedents
+
- Bug #1196315: fix weakref.WeakValueDictionary constructor.
- Bug #1213894: os.path.realpath didn't resolve symlinks that were the first