fix unit tests
This commit is contained in:
parent
cbad41c574
commit
2e8e872dbc
@ -27,7 +27,7 @@ from reflex.event import (
|
|||||||
from reflex.state import BaseState
|
from reflex.state import BaseState
|
||||||
from reflex.style import Style
|
from reflex.style import Style
|
||||||
from reflex.utils import imports
|
from reflex.utils import imports
|
||||||
from reflex.utils.exceptions import EventFnArgMismatch
|
from reflex.utils.exceptions import ChildrenTypeError, EventFnArgMismatch
|
||||||
from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports
|
from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports
|
||||||
from reflex.vars import VarData
|
from reflex.vars import VarData
|
||||||
from reflex.vars.base import LiteralVar, Var
|
from reflex.vars.base import LiteralVar, Var
|
||||||
@ -645,14 +645,17 @@ def test_create_filters_none_props(test_component):
|
|||||||
assert str(component.style["text-align"]) == '"center"'
|
assert str(component.style["text-align"]) == '"center"'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("children", [((None,),), ("foo", ("bar", (None,)))])
|
@pytest.mark.parametrize(
|
||||||
def test_component_create_unallowed_types(children, test_component):
|
"children",
|
||||||
with pytest.raises(TypeError) as err:
|
[
|
||||||
test_component.create(*children)
|
((None,),),
|
||||||
assert (
|
("foo", ("bar", (None,))),
|
||||||
err.value.args[0]
|
({"foo": "bar"},),
|
||||||
== "Children of Reflex components must be other components, state vars, or primitive Python types. Got child None of type <class 'NoneType'>."
|
],
|
||||||
)
|
)
|
||||||
|
def test_component_create_unallowed_types(children, test_component):
|
||||||
|
with pytest.raises(ChildrenTypeError):
|
||||||
|
test_component.create(*children)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
Loading…
Reference in New Issue
Block a user