Skip to content

Commit

Permalink
not_a_child -> invalid_child
Browse files Browse the repository at this point in the history
This name is more consistent.
  • Loading branch information
pelme committed Dec 15, 2024
1 parent 11bf4ff commit 29ec8a9
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/test_children.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,46 +289,46 @@ class SomeClass:
]


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_direct(not_a_child: t.Any) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_direct(invalid_child: t.Any) -> None:
with pytest.raises(TypeError, match="is not a valid child element"):
div[not_a_child]
div[invalid_child]


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_wrapped_in_list(not_a_child: t.Any) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_wrapped_in_list(invalid_child: t.Any) -> None:
with pytest.raises(TypeError, match="is not a valid child element"):
div[[not_a_child]]
div[[invalid_child]]


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_wrapped_in_tuple(not_a_child: t.Any) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_wrapped_in_tuple(invalid_child: t.Any) -> None:
with pytest.raises(TypeError, match="is not a valid child element"):
div[(not_a_child,)]
div[(invalid_child,)]


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_nested_iterator(not_a_child: t.Any) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_nested_iterator(invalid_child: t.Any) -> None:
with pytest.raises(TypeError, match="is not a valid child element"):
div[[not_a_child]]
div[[invalid_child]]


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_lazy_callable(not_a_child: t.Any, render: RenderFixture) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_lazy_callable(invalid_child: t.Any, render: RenderFixture) -> None:
"""
Ensure proper exception is raised for lazily evaluated invalid children.
"""
element = div[lambda: not_a_child]
element = div[lambda: invalid_child]
with pytest.raises(TypeError, match="is not a valid child element"):
render(element)


@pytest.mark.parametrize("not_a_child", _invalid_children)
def test_invalid_child_lazy_iterator(not_a_child: t.Any, render: RenderFixture) -> None:
@pytest.mark.parametrize("invalid_child", _invalid_children)
def test_invalid_child_lazy_iterator(invalid_child: t.Any, render: RenderFixture) -> None:
"""
Ensure proper exception is raised for lazily evaluated invalid children.
"""

element = div[SingleShotIterator(not_a_child)]
element = div[SingleShotIterator(invalid_child)]
with pytest.raises(TypeError, match="is not a valid child element"):
render(element)

0 comments on commit 29ec8a9

Please sign in to comment.