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.style import Style
|
||||
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.vars import VarData
|
||||
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"'
|
||||
|
||||
|
||||
@pytest.mark.parametrize("children", [((None,),), ("foo", ("bar", (None,)))])
|
||||
def test_component_create_unallowed_types(children, test_component):
|
||||
with pytest.raises(TypeError) as err:
|
||||
test_component.create(*children)
|
||||
assert (
|
||||
err.value.args[0]
|
||||
== "Children of Reflex components must be other components, state vars, or primitive Python types. Got child None of type <class 'NoneType'>."
|
||||
@pytest.mark.parametrize(
|
||||
"children",
|
||||
[
|
||||
((None,),),
|
||||
("foo", ("bar", (None,))),
|
||||
({"foo": "bar"},),
|
||||
],
|
||||
)
|
||||
def test_component_create_unallowed_types(children, test_component):
|
||||
with pytest.raises(ChildrenTypeError):
|
||||
test_component.create(*children)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
Loading…
Reference in New Issue
Block a user