|
2 | 2 |
|
3 | 3 | from textual.app import App |
4 | 4 | from textual.widgets import Static |
| 5 | +from textual.css.query import TooManyMatches |
5 | 6 |
|
6 | 7 | async def test_mount_via_app() -> None: |
7 | 8 | """Perform mount tests via the app.""" |
@@ -94,20 +95,9 @@ async def test_mount_via_app() -> None: |
94 | 95 | with pytest.raises(Static.MountError): |
95 | 96 | await pilot.app.mount(Static(), after=Static()) |
96 | 97 |
|
97 | | - # TODO: At the moment query_one() simply takes a query and returns the |
98 | | - # .first() item. As such doing a query_one() that gets more than one |
99 | | - # thing isn't an error, it just skims off the first thing. OTOH the |
100 | | - # intention of before= and after= with a selector is that an exception |
101 | | - # will be thrown -- the exception being the own that should be thrown |
102 | | - # from query_one(). So, this test here is a TODO test because we'll wait |
103 | | - # for a change to query_one() and then its exception will just bubble |
104 | | - # up. |
105 | | - # |
106 | | - # See https://github.com/Textualize/textual/issues/1096 |
107 | | - # |
108 | | - # async with App().run_test() as pilot: |
109 | | - # # Make sure we get an error if we try and mount with a selector that |
110 | | - # # results in more than one hit. |
111 | | - # await pilot.app.mount_all(widgets) |
112 | | - # with pytest.raises( ?Something? ): |
113 | | - # await pilot.app.mount(Static(), before="Static") |
| 98 | + async with App().run_test() as pilot: |
| 99 | + # Make sure we get an error if we try and mount with a selector that |
| 100 | + # results in more than one hit. |
| 101 | + await pilot.app.mount_all(widgets) |
| 102 | + with pytest.raises(TooManyMatches): |
| 103 | + await pilot.app.mount(Static(), before="Static") |
0 commit comments