MCPcopy
hub / github.com/django/django / test_json

Method test_json

tests/gis_tests/gdal_tests/test_geom.py:118–131  ·  view source on GitHub ↗

Testing GeoJSON input/output.

(self)

Source from the content-addressed store, hash-verified

116 self.assertEqual(geom1, geom2)
117
118 def test_json(self):
119 "Testing GeoJSON input/output."
120 for g in self.geometries.json_geoms:
121 geom = OGRGeometry(g.wkt)
122 if not hasattr(g, "not_equal"):
123 # Loading jsons to prevent decimal differences
124 self.assertEqual(json.loads(g.json), json.loads(geom.json))
125 self.assertEqual(json.loads(g.json), json.loads(geom.geojson))
126 self.assertEqual(OGRGeometry(g.wkt), OGRGeometry(geom.json))
127 # Test input with some garbage content (but valid json) (#15529)
128 geom = OGRGeometry(
129 '{"type": "Point", "coordinates": [ 100.0, 0.0 ], "other": "<test>"}'
130 )
131 self.assertIsInstance(geom, OGRGeometry)
132
133 def test_points(self):
134 "Testing Point objects."

Callers

nothing calls this directly

Calls 2

OGRGeometryClass · 0.90
loadsMethod · 0.45

Tested by

no test coverage detected