diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2018-11-21 17:45:50 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2018-11-21 17:45:50 +0100 |
commit | 61077f3fa478a5329ddd4acb12212d1241de4b10 (patch) | |
tree | 264efd0f16ad7eb24c64d4081c766ab0cdfc90b9 | |
parent | e988ffeb676a959725df2b3b971ff0dbb998f573 (diff) | |
download | pyparsing-git-61077f3fa478a5329ddd4acb12212d1241de4b10.tar.gz |
Fix failing tests (both py2K and py3k)
Fixes #48
-rw-r--r-- | examples/antlr_grammar_tests.py | 4 | ||||
-rw-r--r-- | examples/test_bibparse.py | 4 | ||||
-rw-r--r-- | simple_unit_tests.py | 9 |
3 files changed, 9 insertions, 8 deletions
diff --git a/examples/antlr_grammar_tests.py b/examples/antlr_grammar_tests.py index c2c3d8d..1df28f9 100644 --- a/examples/antlr_grammar_tests.py +++ b/examples/antlr_grammar_tests.py @@ -6,7 +6,7 @@ Created on 4 sept. 2010 Submitted by Luca DallOlio, September, 2010 ''' import unittest -import antlr_grammar +from . import antlr_grammar class Test(unittest.TestCase): @@ -84,4 +84,4 @@ fragment DIGIT : '0'..'9' ;""" if __name__ == "__main__": #import sys;sys.argv = ['', 'Test.testOptionsSpec'] - unittest.main()
\ No newline at end of file + unittest.main() diff --git a/examples/test_bibparse.py b/examples/test_bibparse.py index 7440a66..78f5bb7 100644 --- a/examples/test_bibparse.py +++ b/examples/test_bibparse.py @@ -3,8 +3,8 @@ from os.path import join as pjoin, dirname
from pyparsing import ParseException
-from btpyparse import Macro
-import btpyparse as bp
+from .btpyparse import Macro
+from . import btpyparse as bp
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
diff --git a/simple_unit_tests.py b/simple_unit_tests.py index 13278fb..f21b0f2 100644 --- a/simple_unit_tests.py +++ b/simple_unit_tests.py @@ -282,10 +282,11 @@ class TestParseAction(PyparsingExpressionTestCase): class TestResultsModifyingParseAction(PyparsingExpressionTestCase): def compute_stats_parse_action(t): - # by the time this parse action is called, parsed numeric words have been converted to ints - # by a previous parse action, so they can be treated as ints + # by the time this parse action is called, parsed numeric words + # have been converted to ints by a previous parse action, so + # they can be treated as ints t['sum'] = sum(t) - t['ave'] = sum(t) / len(t) + t['ave'] = sum(t) // len(t) t['min'] = min(t) t['max'] = max(t) @@ -295,7 +296,7 @@ class TestResultsModifyingParseAction(PyparsingExpressionTestCase): expr = pp.OneOrMore(pp.pyparsing_common.integer).addParseAction(compute_stats_parse_action), text = "27 1 14 22 89", expected_list = [27, 1, 14, 22, 89], - expected_dict = {'ave': 30.6, 'max': 89, 'min': 1, 'sum': 153} + expected_dict = {'ave': 30, 'max': 89, 'min': 1, 'sum': 153} ), ] |