reflex/tests/units/components/datadisplay/conftest.py
Thomas Brandého 3f538865b5
reorganize all tests in a single top folder (#3981)
* lift node version restraint to allow more recent version if already installed

* add node test for latest version

* change python version

* use purple for debug logs

* update workflow

* add playwright dev dependency

* update workflow

* change test

* oops

* improve test

* update test

* fix tests

* mv units tests to a subfolder

* reorganize tests

* fix install

* update test_state

* revert node changes and only keep new tests organization

* move integration tests in tests/integration

* fix integration workflow

* fix dockerfile workflow

* fix dockerfile workflow 2

* fix shared_state
2024-09-26 01:22:52 +02:00

92 lines
1.6 KiB
Python

"""Data display component tests fixtures."""
from typing import List
import pandas as pd
import pytest
import reflex as rx
from reflex.state import BaseState
@pytest.fixture
def data_table_state(request):
"""Get a data table state.
Args:
request: The request.
Returns:
The data table state class.
"""
class DataTableState(BaseState):
data = request.param["data"]
columns = ["column1", "column2"]
return DataTableState
@pytest.fixture
def data_table_state2():
"""Get a data table state.
Returns:
The data table state class.
"""
class DataTableState(BaseState):
_data = pd.DataFrame()
@rx.var
def data(self):
return self._data
return DataTableState
@pytest.fixture
def data_table_state3():
"""Get a data table state.
Returns:
The data table state class.
"""
class DataTableState(BaseState):
_data: List = []
_columns: List = ["col1", "col2"]
@rx.var
def data(self) -> List:
return self._data
@rx.var
def columns(self):
return self._columns
return DataTableState
@pytest.fixture
def data_table_state4():
"""Get a data table state.
Returns:
The data table state class.
"""
class DataTableState(BaseState):
_data: List = []
_columns: List = ["col1", "col2"]
@rx.var
def data(self):
return self._data
@rx.var
def columns(self) -> List:
return self._columns
return DataTableState