mirror of https://github.com/django/django.git
Refs #25004 -- Fixed test failure introduced by OpenLayers 3 update.
This commit is contained in:
parent
c04207cd38
commit
946dd5bde2
|
@ -1,3 +1,6 @@
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
from django.contrib.gis import forms
|
from django.contrib.gis import forms
|
||||||
from django.contrib.gis.geos import GEOSGeometry
|
from django.contrib.gis.geos import GEOSGeometry
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
|
@ -109,11 +112,12 @@ class GeometryFieldTest(SimpleTestCase):
|
||||||
with patch_logger('django.contrib.gis', 'error') as logger_calls:
|
with patch_logger('django.contrib.gis', 'error') as logger_calls:
|
||||||
output = str(form)
|
output = str(form)
|
||||||
|
|
||||||
self.assertInHTML(
|
# The first point can't use assertInHTML() due to non-deterministic
|
||||||
'<textarea id="id_pt1" class="vSerializedField required" cols="150"'
|
# ordering of the rendered dictionary.
|
||||||
' rows="10" name="pt1">POINT (7.3 44)</textarea>',
|
pt1_serialized = re.search(r'<textarea [^>]*>({[^<]+})<', output).groups()[0]
|
||||||
output
|
pt1_json = json.loads(pt1_serialized.replace('"', '"'))
|
||||||
)
|
self.assertEqual(pt1_json, {'coordinates': [7.3, 44.0], 'type': 'Point'})
|
||||||
|
|
||||||
self.assertInHTML(
|
self.assertInHTML(
|
||||||
'<textarea id="id_pt2" class="vSerializedField required" cols="150"'
|
'<textarea id="id_pt2" class="vSerializedField required" cols="150"'
|
||||||
' rows="10" name="pt2"></textarea>',
|
' rows="10" name="pt2"></textarea>',
|
||||||
|
|
Loading…
Reference in New Issue