summaryrefslogtreecommitdiff
path: root/src/unitTests.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-06-18 13:04:27 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-06-18 13:04:27 +0000
commit4894cef022ca888d5b7962fcc99f996bdd0e6224 (patch)
tree5704e9532759531cffce7c26b7a85469027423c7 /src/unitTests.py
parent191c56031a16a6a7910613fa2be77a670d225996 (diff)
downloadpyparsing-4894cef022ca888d5b7962fcc99f996bdd0e6224.tar.gz
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
Diffstat (limited to 'src/unitTests.py')
-rw-r--r--src/unitTests.py12
1 files changed, 12 insertions, 0 deletions
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):