From 9175a2cc3248acf1f17c845d6c336ec9bba109f8 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sat, 28 Nov 2020 08:58:40 +0100 Subject: [PATCH] Added assertion for geom_type in BaseGeometryWidget.get_context(). --- tests/gis_tests/test_geoforms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py index 0360156b50..74c082e59d 100644 --- a/tests/gis_tests/test_geoforms.py +++ b/tests/gis_tests/test_geoforms.py @@ -374,10 +374,14 @@ class OSMWidgetTest(SimpleTestCase): class GeometryWidgetTests(SimpleTestCase): def test_get_context_attrs(self): - """The Widget.get_context() attrs argument overrides self.attrs.""" + # The Widget.get_context() attrs argument overrides self.attrs. widget = BaseGeometryWidget(attrs={'geom_type': 'POINT'}) context = widget.get_context('point', None, attrs={'geom_type': 'POINT2'}) self.assertEqual(context['geom_type'], 'POINT2') + # Widget.get_context() returns expected name for geom_type. + widget = BaseGeometryWidget(attrs={'geom_type': 'POLYGON'}) + context = widget.get_context('polygon', None, None) + self.assertEqual(context['geom_type'], 'Polygon') def test_subwidgets(self): widget = forms.BaseGeometryWidget()