Skip to content

Commit 10d0ebf

Browse files
committed
Add tests for number type fix
1 parent 23ed645 commit 10d0ebf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_search.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
import decimal
13
from tests import unittest, OrderedDict
24

35
import jmespath
@@ -43,3 +45,14 @@ def test_can_compare_strings(self):
4345
# This is python specific behavior that's not in the official spec
4446
# yet, but this was regression from 0.9.0 so it's been added back.
4547
self.assertTrue(jmespath.search('a < b', {'a': '2016', 'b': '2017'}))
48+
49+
@unittest.skipIf(not hasattr(sys, 'maxint'), 'Test requires long() type')
50+
def test_can_handle_long_ints(self):
51+
result = sys.maxint + 1
52+
self.assertEqual(jmespath.search('[?a >= `1`].a', [{'a': result}]),
53+
[result])
54+
55+
def test_can_handle_decimals_as_numeric_type(self):
56+
result = decimal.Decimal('3')
57+
self.assertEqual(jmespath.search('[?a >= `1`].a', [{'a': result}]),
58+
[result])

0 commit comments

Comments
 (0)