reflex/tests/units/components/datadisplay/conftest.py
Thomas Brandého 4c2b2ed1c6
removing deprecated features for 0.7.0 and removing py3.9 support (#4586)
* remove deprecated features and support for py3.9

* remove other deprecated stuff

* update lock file

* fix units tests

* relock poetry

* fix _replace for computed_var

* fix some merge typo

* fix typing of deploy args

* fix benchmarks.yml versions

* console.error instead of raising Exception

* fix tests

* ignore lambdas when resolving annotations

* simplify redirect logic in event.py

* more fixes

* fix unit tests again

* give back default annotations for lambdas

* fix signature check for on_submit

* remove useless stuff

* update pyi

* readd the getattr

* raise if log_level is wrong type

* silly goose, loglevel is a subclass of str

* i don't believe this code

* add guard

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2025-01-22 11:54:37 -08:00

90 lines
1.6 KiB
Python

"""Data display component tests fixtures."""
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[str] = ["col1", "col2"]
@rx.var
def data(self):
return self._data
@rx.var
def columns(self) -> list:
return self._columns
return DataTableState