Assert if the results JSON file is the same as the expected JSON file.
(expected, results, regen=REGEN_TEST_FIXTURES)
| 400 | |
| 401 | |
| 402 | def check_json(expected, results, regen=REGEN_TEST_FIXTURES): |
| 403 | """ |
| 404 | Assert if the results JSON file is the same as the expected JSON file. |
| 405 | """ |
| 406 | if regen: |
| 407 | with open(expected, 'w') as ex: |
| 408 | json.dump(results, ex, indent=2, separators=(',', ': ')) |
| 409 | with open(expected) as ex: |
| 410 | expected = json.load(ex) |
| 411 | |
| 412 | if results != expected: |
| 413 | expected = saneyaml.dump(expected) |
| 414 | results = saneyaml.dump(results) |
| 415 | assert results == expected |
| 416 | |
| 417 | |
| 418 | def load_both_and_check_json(expected, results, regen=REGEN_TEST_FIXTURES): |
no test coverage detected