[Python-checkins] python/dist/src/Lib/test test_tokenize.py, 1.9, 1.9.12.1
rhettinger@users.sourceforge.net
rhettinger at users.sourceforge.net
Tue Jun 21 09:53:58 CEST 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31482/Lib/test
Modified Files:
Tag: release24-maint
test_tokenize.py
Log Message:
SF bug #1224621: tokenize module does not detect inconsistent dedents
Index: test_tokenize.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tokenize.py,v
retrieving revision 1.9
retrieving revision 1.9.12.1
diff -u -d -r1.9 -r1.9.12.1
--- test_tokenize.py 12 May 2003 19:42:04 -0000 1.9
+++ test_tokenize.py 21 Jun 2005 07:53:56 -0000 1.9.12.1
@@ -1,4 +1,4 @@
-from test.test_support import verbose, findfile
+from test.test_support import verbose, findfile, TestFailed
import tokenize, os, sys
if verbose:
@@ -10,3 +10,21 @@
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:")
More information about the Python-checkins
mailing list