This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, vajrasky
Date 2013-08-28.07:15:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377674110.11.0.856291584413.issue18745@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-08-28 07:15:10ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky, vajrasky
2013-08-28 07:15:10ethan.furmansetmessageid: <1377674110.11.0.856291584413.issue18745@psf.upfronthosting.co.za>
2013-08-28 07:15:10ethan.furmanlinkissue18745 messages
2013-08-28 07:15:09ethan.furmancreate