Complete coverage of arrangement doc options

While the code in _arrange.py does mark the unknown dock type branch as
being for the benefit of type checkers only, and was marked as to be ignored
for the purposes of coverage, it was still showing in a coverage test and
it's not a terrible thing to ensure that a user, giving the wrong type of
dock in their own code, will get the expected result.
This commit is contained in:
Dave Pearson
2022-10-24 11:43:02 +01:00
parent d7da8c6851
commit 472ca5cd3f

View File

@@ -1,3 +1,5 @@
import pytest
from textual._arrange import arrange, TOP_Z
from textual._layout import WidgetPlacement
from textual.geometry import Region, Size, Spacing
@@ -91,3 +93,9 @@ def test_arrange_dock_bottom():
]
assert widgets == {child, header}
assert spacing == Spacing(0, 0, 1, 0)
def test_arrange_dock_badly():
child = Widget(id="child")
child.styles.dock = "nowhere"
with pytest.raises(AssertionError):
_ = arrange( Widget(), [child], Size(80, 24), Size(80, 24))