JSON with duplicate keys should be handled correctly.
()
| 93 | |
| 94 | @responses.activate |
| 95 | def test_duplicate_keys_support_from_response(): |
| 96 | """JSON with duplicate keys should be handled correctly.""" |
| 97 | responses.add( |
| 98 | responses.GET, |
| 99 | DUMMY_URL, |
| 100 | body=JSON_WITH_DUPES_RAW, |
| 101 | content_type='application/json', |
| 102 | ) |
| 103 | args = ('--pretty', 'format', DUMMY_URL) |
| 104 | |
| 105 | # Check implicit --sorted |
| 106 | if JsonDictPreservingDuplicateKeys.SUPPORTS_SORTING: |
| 107 | r = http(*args) |
| 108 | assert JSON_WITH_DUPES_FORMATTED_SORTED in r |
| 109 | |
| 110 | # Check --unsorted |
| 111 | r = http(*args, '--unsorted') |
| 112 | assert JSON_WITH_DUPES_FORMATTED_UNSORTED in r |
| 113 | |
| 114 | |
| 115 | def test_duplicate_keys_support_from_input_file(): |