Add a reminder to the mount tests about query_one

See https://github.com/Textualize/textual/issues/1096
This commit is contained in:
Dave Pearson
2022-11-02 15:57:09 +00:00
parent b925fb6b19
commit f29015f70a

View File

@@ -79,3 +79,21 @@ async def test_mount_via_app() -> None:
await pilot.app.mount(Static(), before=Static())
with pytest.raises(Static.MountError):
await pilot.app.mount(Static(), after=Static())
# TODO: At the moment query_one() simply takes a query and returns the
# .first() item. As such doing a query_one() that gets more than one
# thing isn't an error, it just skims off the first thing. OTOH the
# intention of before= and after= with a selector is that an exception
# will be thrown -- the exception being the own that should be thrown
# from query_one(). So, this test here is a TODO test because we'll wait
# for a change to query_one() and then its exception will just bubble
# up.
#
# See https://github.com/Textualize/textual/issues/1096
#
# async with App().run_test() as pilot:
# # Make sure we get an error if we try and mount with a selector that
# # results in more than one hit.
# await pilot.app.mount_all(widgets)
# with pytest.raises( ?Something? ):
# await pilot.app.mount(Static(), before="Static")