From b1f79f28eeb5c62bb49819d1e96def408a3c83b2 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 23 Mar 2015 12:17:09 +0100 Subject: [PATCH] tests - update feature_test --- tests/python_tests/feature_test.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tests/python_tests/feature_test.py b/tests/python_tests/feature_test.py index 42f024509..c5250127b 100644 --- a/tests/python_tests/feature_test.py +++ b/tests/python_tests/feature_test.py @@ -14,7 +14,7 @@ def test_default_constructor(): def test_feature_geo_interface(): ctx = mapnik.Context() feat = mapnik.Feature(ctx,1) - feat.add_geometries_from_wkt('Point (0 0)') + feat.geometry = mapnik.Geometry.from_wkt('Point (0 0)') eq_(feat.__geo_interface__['geometry'],{u'type': u'Point', u'coordinates': [0, 0]}) def test_python_extended_constructor(): @@ -23,7 +23,7 @@ def test_python_extended_constructor(): context.push('foo') f = mapnik.Feature(context,1) wkt = 'POLYGON ((35 10, 10 20, 15 40, 45 45, 35 10),(20 30, 35 35, 30 20, 20 30))' - f.add_geometries_from_wkt(wkt) + f.geometry = mapnik.Geometry.from_wkt(wkt) f['foo'] = 'bar' eq_(f['foo'], 'bar') eq_(f.envelope(),mapnik.Box2d(10.0,10.0,45.0,45.0)) @@ -40,18 +40,10 @@ def test_add_geom_wkb(): wkb = '010300000001000000050000000000000000003e4000000000000024400000000000002440000000000000344000000000000034400000000000004440000000000000444000000000000044400000000000003e400000000000002440' context = mapnik.Context() f = mapnik.Feature(context,1) - eq_(len(f.geometries()), 0) - f.add_geometries_from_wkb(unhexlify(wkb)) - eq_(len(f.geometries()), 1) - e = mapnik.Box2d() - eq_(e.valid(), False) - for g in f.geometries(): - if not e.valid(): - e = g.envelope() - else: - e +=g.envelope() - - eq_(e, f.envelope()) + f.geometry = mapnik.Geometry.from_wkb(unhexlify(wkb)) + eq_(f.geometry.is_valid(), True) + eq_(f.geometry.is_simple(), True) + eq_(f.geometry.envelope(), f.envelope()) def test_feature_expression_evaluation(): context = mapnik.Context()