From 4894cef022ca888d5b7962fcc99f996bdd0e6224 Mon Sep 17 00:00:00 2001 From: ptmcg Date: Sat, 18 Jun 2016 13:04:27 +0000 Subject: Fixed bug in pyparsing_common.numeric, integers were parsed as floats git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@371 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b --- src/unitTests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/unitTests.py') diff --git a/src/unitTests.py b/src/unitTests.py index 90cbc2a..0de3b97 100644 --- a/src/unitTests.py +++ b/src/unitTests.py @@ -2777,6 +2777,18 @@ class CommonExpressionsTest(ParseTestCase): """)[0] assert success, "failed to parse valid mixed integer" + success, results = pyparsing_common.numeric.runTests(""" + 100 + -3 + 1.732 + -3.14159 + 6.02e23""") + assert success, "failed to parse numerics" + for test,result in results: + expected = eval(test) + assert result[0] == expected, "numeric parse failed (wrong value) (%s should be %s)" % (result[0], expected) + assert type(result[0]) == type(expected), "numeric parse failed (wrong type) (%s should be %s)" % (type(result[0]), type(expected)) + class TokenMapTest(ParseTestCase): def runTest(self): -- cgit v1.2.1