File: test_null_geometries.py

package info (click to toggle)
python-geojson 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 288 kB
  • sloc: python: 1,081; makefile: 7
file content (27 lines) | stat: -rw-r--r-- 844 bytes parent folder | download | duplicates (5)
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)