blob: 5dd20d36f9f0fe677ae1c006da30d38e4cc3a44e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
from test.test_support import verbose, findfile, TestFailed
import tokenize, os, sys
if verbose:
print 'starting...'
f = file(findfile('tokenize_tests' + os.extsep + 'txt'))
tokenize.tokenize(f.readline)
f.close()
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:")
|