again: try to use unicode, #52

This commit is contained in:
David Halter
2012-11-02 18:05:04 +01:00
parent 948b72d27f
commit ee524eb2a9
3 changed files with 4 additions and 9 deletions

View File

@@ -69,17 +69,15 @@ else:
exec source in global_map """, 'blub', 'exec')) exec source in global_map """, 'blub', 'exec'))
# tokenize function # tokenize function
# TODO remove this, not used anymore
import tokenize import tokenize
if is_py3k: tokenize_func = tokenize.generate_tokens
tokenize_func = tokenize.tokenize
else:
tokenize_func = tokenize.generate_tokens
# BytesIO (Python 2.5 has no io module) # BytesIO (Python 2.5 has no io module)
try: try:
from StringIO import StringIO as BytesIO from StringIO import StringIO as BytesIO
except ImportError: except ImportError:
from io import BytesIO as BytesIO from io import StringIO as BytesIO
# hasattr function used because python # hasattr function used because python
if is_py3k: if is_py3k:

View File

@@ -1126,8 +1126,6 @@ class PyFuzzyParser(object):
self.user_stmt = None self.user_stmt = None
self.code = code + '\n' # end with \n, because the parser needs it self.code = code + '\n' # end with \n, because the parser needs it
self.no_docstr = no_docstr self.no_docstr = no_docstr
if is_py3k:
self.code = self.code.encode()
# initialize global Scope # initialize global Scope
self.module = Module(module_path) self.module = Module(module_path)

View File

@@ -212,8 +212,7 @@ def test_dir(completion_test_dir, thirdparty=False):
path = os.path.join(completion_test_dir, f_name) path = os.path.join(completion_test_dir, f_name)
f = open(path) f = open(path)
num_tests, fails = run_test(unicode(f.read()), f_name, num_tests, fails = run_test(f.read(), f_name, lines_to_execute)
lines_to_execute)
s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name) s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
tests_fail += fails tests_fail += fails