Message196353
The added tests for inf, -inf, and nan are good.
The refactoring of the dictionary tests are not good. The reason is that before _json.c was fixed (issue18264) it would return the string value of an IntEnum instead of the string value of the IntEnum member's value attribute.
--> class Number(IntEnum):
... one = 1
... two = 2
--> json.dumps(Number.one)
'Number.one' # should be '1'
As a constant we get a failure when trying to round-trip:
--> json.loads(json.dumps(Number.one))
Traceback (most recent call last):
...
ValueError: Expecting value: line 1 column 1 (char 0)
But as a dictionary we do not (because keys get morphed into strings):
--> json.dumps({Number.one: 'one'})
'{"Number.one": "one"}' # should be '{"1": "one"}'
Which round-trips fine, but yields the wrong result:
>>> loads(dumps({Number.one: 'one'}))
{'Number.one': 'one'} # should be {'1': 'one'}
So the dictionary tests (and the list tests) are there to make sure that json.dumps is converting them properly, not to make sure that they round-trip, and by changing from repr to loads/dumps the point of the test is lost.
Updated tests attached. |
|
Date |
User |
Action |
Args |
2013-08-28 07:15:10 | ethan.furman | set | recipients:
+ ethan.furman, barry, eli.bendersky, vajrasky |
2013-08-28 07:15:10 | ethan.furman | set | messageid: <1377674110.11.0.856291584413.issue18745@psf.upfronthosting.co.za> |
2013-08-28 07:15:10 | ethan.furman | link | issue18745 messages |
2013-08-28 07:15:09 | ethan.furman | create | |
|