From 073ea85a376fc8f0253a6d0160ad3bd7b1c3c83d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 6 Jan 2023 22:30:21 +0000 Subject: Update handling of non-finite numbers to match jq 1.6 --- tests/jq_tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/jq_tests.py b/tests/jq_tests.py index 4eab9f7..bcacdca 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -20,6 +20,27 @@ def test_can_add_one_to_each_element_of_an_array(): ) +def test_nan_is_outputted_as_null(): + assert_equal( + None, + jq.compile("0/0").input(0).first(), + ) + + +def test_positive_infinity_is_outputted_as_positive_max_double(): + assert_equal( + 1.7976931348623157e+308, + jq.compile(". * 2").input(1.7976931348623157e+308).first(), + ) + + +def test_negative_infinity_is_outputted_as_negative_max_double(): + assert_equal( + -1.7976931348623157e+308, + jq.compile(". * 2").input(-1.7976931348623157e+308).first(), + ) + + def test_can_use_regexes(): assert_equal( True, -- cgit v1.2.3