test_chart_utils.py 674 B

123456789101112131415161718192021222324
  1. import pytest
  2. from flexmeasures.data.models.charts.defaults import merge_vega_lite_specs
  3. @pytest.mark.parametrize(
  4. "default_specs, custom_specs, expected_specs",
  5. [
  6. (
  7. {"legend": {"titleFontSize": 16}},
  8. {"title": "foo"},
  9. {"legend": {"titleFontSize": 16}, "title": "foo"},
  10. ),
  11. (
  12. {"title": {"fontSize": 16}},
  13. {"title": "foo"},
  14. {"title": {"fontSize": 16, "text": "foo"}},
  15. ),
  16. ],
  17. )
  18. def test_merge_vega_lite_specs(
  19. default_specs: dict, custom_specs: dict, expected_specs: dict
  20. ):
  21. assert merge_vega_lite_specs(default_specs, custom_specs) == expected_specs