From 472ca5cd3fcdedb9c2198ebf6c33095c675c48c8 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 24 Oct 2022 11:43:02 +0100 Subject: [PATCH] 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. --- tests/test_arrange.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_arrange.py b/tests/test_arrange.py index 580d68e02..f66f01954 100644 --- a/tests/test_arrange.py +++ b/tests/test_arrange.py @@ -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))