1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
import unittest
import geojson
class NullGeometriesTest(unittest.TestCase):
def test_null_geometry_explicit(self):
feature = geojson.Feature(
id=12,
geometry=None,
properties={'foo': 'bar'}
)
actual = geojson.dumps(feature, sort_keys=True)
expected = ('{"geometry": null, "id": 12, "properties": {"foo": '
'"bar"}, "type": "Feature"}')
self.assertEqual(actual, expected)
def test_null_geometry_implicit(self):
feature = geojson.Feature(
id=12,
properties={'foo': 'bar'}
)
actual = geojson.dumps(feature, sort_keys=True)
expected = ('{"geometry": null, "id": 12, "properties": {"foo": '
'"bar"}, "type": "Feature"}')
self.assertEqual(actual, expected)
|