add failing test for figure_out_type

This commit is contained in:
Benedikt Bartscher 2024-10-10 18:01:20 +02:00
parent f3b8b2e336
commit e56c7baa39
No known key found for this signature in database

View File

@ -5,6 +5,12 @@ import pytest
from reflex.vars.base import figure_out_type from reflex.vars.base import figure_out_type
class CustomDict(dict[str, str]):
"""A custom dict."""
pass
@pytest.mark.parametrize( @pytest.mark.parametrize(
("value", "expected"), ("value", "expected"),
[ [
@ -15,6 +21,7 @@ from reflex.vars.base import figure_out_type
([1, 2.0, "a"], List[Union[int, float, str]]), ([1, 2.0, "a"], List[Union[int, float, str]]),
({"a": 1, "b": 2}, Dict[str, int]), ({"a": 1, "b": 2}, Dict[str, int]),
({"a": 1, 2: "b"}, Dict[Union[int, str], Union[str, int]]), ({"a": 1, 2: "b"}, Dict[Union[int, str], Union[str, int]]),
(CustomDict(), CustomDict),
], ],
) )
def test_figure_out_type(value, expected): def test_figure_out_type(value, expected):