MCPcopy
hub / github.com/django/django / test_wkt_writer_precision

Method test_wkt_writer_precision

tests/gis_tests/geos_tests/test_io.py:168–194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

166 )
167
168 def test_wkt_writer_precision(self):
169 wkt_w = WKTWriter()
170 self.assertIsNone(wkt_w.precision)
171 self.assertEqual(
172 wkt_w.write(Point(1.0 / 3, 2.0 / 3)),
173 b"POINT (0.3333333333333333 0.6666666666666666)",
174 )
175
176 wkt_w.precision = 1
177 self.assertEqual(wkt_w.precision, 1)
178 self.assertEqual(wkt_w.write(Point(1.0 / 3, 2.0 / 3)), b"POINT (0.3 0.7)")
179
180 wkt_w.precision = 0
181 self.assertEqual(wkt_w.precision, 0)
182 self.assertEqual(wkt_w.write(Point(1.0 / 3, 2.0 / 3)), b"POINT (0 1)")
183
184 wkt_w.precision = None
185 self.assertIsNone(wkt_w.precision)
186 self.assertEqual(
187 wkt_w.write(Point(1.0 / 3, 2.0 / 3)),
188 b"POINT (0.3333333333333333 0.6666666666666666)",
189 )
190
191 with self.assertRaisesMessage(
192 AttributeError, "WKT output rounding precision must be "
193 ):
194 wkt_w.precision = "potato"
195
196 def test_empty_point_wkb(self):
197 p = Point(srid=4326)

Callers

nothing calls this directly

Calls 4

writeMethod · 0.95
WKTWriterClass · 0.90
PointClass · 0.90
assertRaisesMessageMethod · 0.80

Tested by

no test coverage detected