summaryrefslogtreecommitdiff
path: root/tests/gis_tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2022-08-12 12:18:51 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-08-12 13:26:35 +0200
commit4fcba800b84fc5fb53cdc70e4bea37ec958516fd (patch)
tree4ca13bb1947503e1a1202a0513deda760bc8090e /tests/gis_tests
parent8c3046daade8d9b019928f96e53629b03060fe73 (diff)
downloaddjango-4fcba800b84fc5fb53cdc70e4bea37ec958516fd.tar.gz
Fixed #33924 -- Deprecated BaseGeometryWidget.map_height/map_width attributes.
Diffstat (limited to 'tests/gis_tests')
-rw-r--r--tests/gis_tests/test_geoforms.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py
index d1bc43b9da..b8105645bf 100644
--- a/tests/gis_tests/test_geoforms.py
+++ b/tests/gis_tests/test_geoforms.py
@@ -5,6 +5,7 @@ from django.contrib.gis.forms import BaseGeometryWidget, OpenLayersWidget
from django.contrib.gis.geos import GEOSGeometry
from django.core.exceptions import ValidationError
from django.test import SimpleTestCase, override_settings
+from django.utils.deprecation import RemovedInDjango51Warning
from django.utils.html import escape
@@ -485,3 +486,19 @@ class GeometryWidgetTests(SimpleTestCase):
form = PointForm(data={"p": point.json})
self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data["p"].srid, 4326)
+
+ def test_deprecated_width_and_height(self):
+ class CustomGeometryWidget(forms.BaseGeometryWidget):
+ map_height = 300
+ map_width = 550
+
+ msg = (
+ "The map_height and map_width widget attributes are deprecated. Please use "
+ "CSS to size map widgets."
+ )
+ with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
+ CustomGeometryWidget()
+ with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
+ forms.BaseGeometryWidget({"map_width": 400})
+ with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
+ forms.BaseGeometryWidget({"map_height": 600})