Skip to content

Commit

Permalink
Add theme check to python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Oct 4, 2023
1 parent 5692394 commit bc96c6e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions vl-convert-python/tests/test_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ def test_vegalite_to_html_no_bundle(name, vl_version):
assert "cdn.jsdelivr.net/npm/vega@5" in html
assert "cdn.jsdelivr.net/npm/vega-embed@6" in html

# Check themes
html = vlc.vegalite_to_html(
vl_spec, vl_version=vl_version, bundle=False, theme="fivethirtyeight"
)
assert '{"theme":"fivethirtyeight"}' in html
assert '{"theme":"dark"}' not in html

html = vlc.vegalite_to_html(
vl_spec, vl_version=vl_version, bundle=False, theme="dark"
)
assert '{"theme":"dark"}' in html


@pytest.mark.parametrize("name", ["circle_binned"])
@pytest.mark.parametrize(
Expand All @@ -135,6 +147,18 @@ def test_vegalite_to_html_bundle(name, vl_version):
assert vl_version in html
assert "Jeffrey Heer" in html

# Make sure themes aren't cached
html = vlc.vegalite_to_html(
vl_spec, vl_version=vl_version, bundle=True, theme="fivethirtyeight"
)
assert '{"theme":"fivethirtyeight"}' in html
assert '{"theme":"dark"}' not in html

html = vlc.vegalite_to_html(
vl_spec, vl_version=vl_version, bundle=True, theme="dark"
)
assert '{"theme":"dark"}' in html


@pytest.mark.parametrize("name", ["circle_binned", "stacked_bar_h"])
@pytest.mark.parametrize("as_dict", [False, True])
Expand Down

0 comments on commit bc96c6e

Please sign in to comment.