From 10c53385f85aa424e83c65a002d5ca1679d2dd71 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 16 Apr 2016 10:50:24 +0200 Subject: Fixed #26510 -- Allowed dim/trim/precision as WKTWriter init arguments Thanks Tim Graham for the review. --- tests/gis_tests/geos_tests/test_io.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/gis_tests/geos_tests/test_io.py b/tests/gis_tests/geos_tests/test_io.py index e761cd61a3..10762c0821 100644 --- a/tests/gis_tests/geos_tests/test_io.py +++ b/tests/gis_tests/geos_tests/test_io.py @@ -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 -- cgit v1.3