From 452657e02e0e7e1bdbe7e7ba67ee0439758b22dd Mon Sep 17 00:00:00 2001 From: Antony Milne Date: Thu, 23 Nov 2023 13:06:19 +0000 Subject: [PATCH] Add custom assert for tests --- vizro-core/tests/integration/test_navigation.py | 4 ++-- vizro-core/tests/tests_utils/__init__.py | 4 ---- .../tests/unit/vizro/models/_navigation/test_accordion.py | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/vizro-core/tests/integration/test_navigation.py b/vizro-core/tests/integration/test_navigation.py index 0e8c1fcd5..0ad8eed79 100644 --- a/vizro-core/tests/integration/test_navigation.py +++ b/vizro-core/tests/integration/test_navigation.py @@ -2,7 +2,7 @@ import vizro.models as vm -from tests_utils import component_to_dict +from asserts import assert_components_equal from vizro import Vizro from vizro.managers import model_manager @@ -152,4 +152,4 @@ def label_cases(cases, label): def test_navigation_build(dashboard_result, dashboard_expected): result = dashboard_result.navigation.build() expected = dashboard_expected.navigation.build() - assert component_to_dict(result) == component_to_dict(expected) + assert_components_equal(result, expected) diff --git a/vizro-core/tests/tests_utils/__init__.py b/vizro-core/tests/tests_utils/__init__.py index 1135739dc..e69de29bb 100644 --- a/vizro-core/tests/tests_utils/__init__.py +++ b/vizro-core/tests/tests_utils/__init__.py @@ -1,4 +0,0 @@ -# This is not actually required but helps PyCharm find the right function when using "Go to declaration". -# The strange structure here is necessary so that tests_utils can be imported in an intuitive way without adding the -# whole tests folder to the pythonpath. See https://stackoverflow.com/a/75635524. -from asserts import assert_components_equal diff --git a/vizro-core/tests/unit/vizro/models/_navigation/test_accordion.py b/vizro-core/tests/unit/vizro/models/_navigation/test_accordion.py index dd1830a4d..583089890 100644 --- a/vizro-core/tests/unit/vizro/models/_navigation/test_accordion.py +++ b/vizro-core/tests/unit/vizro/models/_navigation/test_accordion.py @@ -3,13 +3,13 @@ import re import dash_bootstrap_components as dbc -import plotly import pytest from dash import html from pydantic import ValidationError import vizro.models as vm -from tests_utils import assert_components_equal +from asserts import assert_components_equal + from vizro._constants import ACCORDION_DEFAULT_TITLE