baseline_data.py 561 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (c) 2014-2020 Richard Hull and contributors
  4. # See LICENSE.rst for details.
  5. """
  6. Collection of datasets to prevent regression bugs from creeping in.
  7. """
  8. import json
  9. from pathlib import Path
  10. def get_json_data(fname):
  11. """
  12. Load JSON reference data.
  13. :param fname: Filename without extension.
  14. :type fname: str
  15. """
  16. base_dir = Path(__file__).resolve().parent
  17. fpath = base_dir.joinpath('reference', 'data', fname + '.json')
  18. with fpath.open() as f:
  19. return json.load(f)