diff --git a/csvkit/utilities/csvjson.py b/csvkit/utilities/csvjson.py index 5b493e8bf..d0b0c241c 100644 --- a/csvkit/utilities/csvjson.py +++ b/csvkit/utilities/csvjson.py @@ -134,7 +134,7 @@ def dump_json(data, newline=False): max_lon = lon elif i == id_column: geoid = c - else: + elif c: properties[table.column_names[i]] = c if id_column is not None: diff --git a/tests/test_utilities/test_csvjson.py b/tests/test_utilities/test_csvjson.py index 25f37e4bb..177c1df18 100644 --- a/tests/test_utilities/test_csvjson.py +++ b/tests/test_utilities/test_csvjson.py @@ -73,7 +73,9 @@ def test_geojson(self): for feature in geojson['features']: self.assertEqual(feature['type'], 'Feature') self.assertFalse('id' in feature) - self.assertEqual(len(feature['properties']), 10) + self.assertIn('properties', feature) + self.assertIsInstance(feature['properties'], dict) + self.assertGreater(len(feature['properties']), 1) geometry = feature['geometry'] @@ -92,7 +94,9 @@ def test_geojson_with_id(self): for feature in geojson['features']: self.assertEqual(feature['type'], 'Feature') self.assertTrue('id' in feature) - self.assertEqual(len(feature['properties']), 9) + self.assertIn('properties', feature) + self.assertIsInstance(feature['properties'], dict) + self.assertGreater(len(feature['properties']), 1) geometry = feature['geometry']