[New-bugs-announce] [issue18745] Test enum in test_json is ignorant of infinity value
report at bugs.python.org
Thu Aug 15 09:59:00 CEST 2013
New submission from Vajrasky Kok:
Test enum json in Lib/test/test_json/test_enum.py is ignorant of infinity values. Also, NaN, but since NaN is a weirdo, let's not take that into account.
The unit test should represent of what will work in every case. For example:
for enum in FloatNum:
This will fail if enum is infinity.
This wisdom about infinity was bestowed upon me when I was reading Lib/test/test_json/test_float.py.
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
for num in [1, 1<<32, 1<<64]:
As you can see, in float case, we don't use str(num) because it does not work with infinity.
Attached the patch to refactor the test to handle infinity value. For the completeness sake, I added the case of negative infinity and NaN as well.
nosy: ethan.furman, vajrasky
title: Test enum in test_json is ignorant of infinity value
versions: Python 3.4
Added file: http://bugs.python.org/file31298/add_infinity_to_test_enum_in_json.patch
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce