Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 23, 2025
1 parent 611e639 commit bb5b859
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions vizro-core/tests/unit/vizro/_themes/test_create_chart_template.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest
from pathlib import Path
from unittest.mock import mock_open, patch

import pytest

from vizro._themes.create_chart_templates import _extract_last_two_occurrences, extract_bs_variables_from_css_file


@pytest.fixture
def css_content():
css_content = """
Expand All @@ -14,7 +16,7 @@ def css_content():
:root, [data-bs-theme=dark] {
--bs-primary: #375a7f;
--bs-secondary: #6c757d;
}
[data-bs-theme=light] {
--bs-primary: #976fd1;
Expand All @@ -24,20 +26,20 @@ def css_content():

return css_content


@pytest.mark.parametrize(
"variable, expected",
[
("--bs-primary", ("#375a7f", "#976fd1")),
("--bs-secondary", ("#6c757d", "#444fff")),
("--bs-tertiary", (None, None)),
],
)
"variable, expected",
[
("--bs-primary", ("#375a7f", "#976fd1")),
("--bs-secondary", ("#6c757d", "#444fff")),
("--bs-tertiary", (None, None)),
],
)
def test_extract_last_two_occurrences(variable, css_content, expected):
result_dark, result_light = _extract_last_two_occurrences(variable, css_content)
assert (result_dark, result_light) == expected



def test_extract_bs_variables_from_css_file(css_content):
variables = ["--bs-primary", "--bs-secondary", "--bs-tertiary"]
expected_dark = {
Expand Down

0 comments on commit bb5b859

Please sign in to comment.