mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #26510 -- Allowed dim/trim/precision as WKTWriter init arguments
Thanks Tim Graham for the review.
This commit is contained in:
@@ -42,6 +42,12 @@ class GEOSIOTest(SimpleTestCase):
|
||||
ref_wkt = 'POINT (5.0000000000000000 23.0000000000000000)'
|
||||
self.assertEqual(ref_wkt, wkt_w.write(ref).decode())
|
||||
|
||||
def test_wktwriter_constructor_arguments(self):
|
||||
wkt_w = WKTWriter(dim=3, trim=True, precision=3)
|
||||
ref = GEOSGeometry('POINT (5.34562 23 1.5)')
|
||||
ref_wkt = 'POINT Z (5.35 23 1.5)'
|
||||
self.assertEqual(ref_wkt, wkt_w.write(ref).decode())
|
||||
|
||||
def test03_wkbreader(self):
|
||||
# Creating a WKBReader instance
|
||||
wkb_r = WKBReader()
|
||||
@@ -101,7 +107,7 @@ class GEOSIOTest(SimpleTestCase):
|
||||
|
||||
# Ensuring bad output dimensions are not accepted
|
||||
for bad_outdim in (-1, 0, 1, 4, 423, 'foo', None):
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaisesMessage(ValueError, 'WKB output dimension must be 2 or 3'):
|
||||
wkb_w.outdim = bad_outdim
|
||||
|
||||
# Now setting the output dimensions to be 3
|
||||
|
||||
Reference in New Issue
Block a user