Staging
v0.8.1
https://github.com/python/cpython
Raw File
Tip revision: 3b9c0f4aca53c751816b4170adbeae0906641b33 authored by Martin v. Löwis on 13 December 2008, 13:37:04 UTC
Add 2.4.6 uuids.
Tip revision: 3b9c0f4
test_tokenize.py
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:")
back to top