Skip to content

Commit

Permalink
adjusting tests to keep up with code change
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Oct 25, 2023
1 parent ff3f9ff commit 7632ea7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions vizro-core/tests/unit/vizro/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import vizro.models as vm
import vizro.plotly.express as px
from vizro.tables import dash_data_table


@pytest.fixture
Expand All @@ -24,6 +25,10 @@ def standard_px_chart(gapminder):
size_max=60,
)

@pytest.fixture
def standard_dash_table(gapminder):
return dash_data_table(data_frame=gapminder)


@pytest.fixture
def standard_go_chart(gapminder):
Expand Down
15 changes: 8 additions & 7 deletions vizro-core/tests/unit/vizro/models/_components/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
from vizro.tables import dash_data_table


@pytest.fixture
def standard_dash_table():
return dash_data_table(data_frame=px.data.gapminder())


@pytest.fixture
def dash_table_with_arguments():
return dash_data_table(data_frame=px.data.gapminder(), style_header={"border": "1px solid green"})
Expand All @@ -31,7 +26,13 @@ def dash_table_with_str_dataframe():

@pytest.fixture
def expected_table():
return html.Div(dash_table.DataTable(pd.DataFrame().to_dict("records"), []), id="text_table")
return html.Div(
[
None,
html.Div(dash_table.DataTable(), id="text_table"),
],
className="table-container",
)


class TestDunderMethodsTable:
Expand Down Expand Up @@ -109,7 +110,7 @@ def test_process_figure_data_frame_df(self, standard_dash_table, gapminder):


class TestBuildTable:
def test_graph_build(self, standard_dash_table, expected_table):
def test_table_build(self, standard_dash_table, expected_table):
table = vm.Table(
id="text_table",
figure=standard_dash_table,
Expand Down
4 changes: 2 additions & 2 deletions vizro-core/tests/unit/vizro/models/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def test_set_layout_invalid(self):
with pytest.raises(ValidationError, match="Number of page and grid components need to be the same."):
vm.Page(title="Page 4", components=[vm.Button()], layout=vm.Layout(grid=[[0, 1]]))

def test_valid_component_types(self, standard_px_chart):
def test_valid_component_types(self, standard_px_chart,standard_dash_table):
vm.Page(
title="Page Title",
components=[vm.Graph(figure=standard_px_chart), vm.Card(text="""# Header 1"""), vm.Button()],
components=[vm.Graph(figure=standard_px_chart), vm.Card(text="""# Header 1"""), vm.Button(),vm.Table(figure=standard_dash_table)],
)

@pytest.mark.parametrize(
Expand Down

0 comments on commit 7632ea7

Please sign in to comment.