<s> from imposm . geom import LimitPolygonGeometry , EmtpyGeometryError <EOL> from shapely . wkt import loads <EOL> from nose . tools import raises <EOL> class TestLimitPolygonGeometry ( object ) : <EOL> @ raises ( EmtpyGeometryError ) <EOL> def test_linestring_no_intersection ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> limit_to . intersection ( loads ( '<STR_LIT>' ) ) <EOL> def test_linestring ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> geom = limit_to . intersection ( loads ( '<STR_LIT>' ) ) <EOL> assert geom . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> def test_linestring_contained ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> test_geom = loads ( '<STR_LIT>' ) <EOL> geom = limit_to . intersection ( test_geom ) <EOL> assert geom is test_geom <EOL> def test_linestring_multilinestring_result ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> geom = limit_to . intersection ( loads ( '<STR_LIT>' ) ) <EOL> assert isinstance ( geom , list ) <EOL> assert geom [ <NUM_LIT:0> ] . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> assert geom [ <NUM_LIT:1> ] . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> @ raises ( EmtpyGeometryError ) <EOL> def test_linestring_point_result ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> geom = limit_to . intersection ( loads ( '<STR_LIT>' ) ) <EOL> def test_linestring_mixed_result ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> geom = limit_to . intersection ( loads ( '<STR_LIT>' ) ) <EOL> assert isinstance ( geom , list ) <EOL> assert len ( geom ) == <NUM_LIT:1> <EOL> assert geom [ <NUM_LIT:0> ] . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> def test_polygon_mixed_result ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> test_geom = loads ( '<STR_LIT>' ) <EOL> geom = limit_to . intersection ( test_geom ) <EOL> assert isinstance ( geom , list ) <EOL> assert len ( geom ) == <NUM_LIT:2> <EOL> assert geom [ <NUM_LIT:0> ] . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> assert geom [ <NUM_LIT:1> ] . almost_equals ( loads ( '<STR_LIT>' ) ) <EOL> def test_polygon_multipolygon_result ( self ) : <EOL> geom = '<STR_LIT>' <EOL> limit_to = LimitPolygonGeometry ( loads ( geom ) ) <EOL> test_geom = loads ( '<STR_LIT>' ) <EOL> geom = limit_to . intersection ( test_geom ) <EOL> assert geom . almost_equals ( loads ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) ) </s>
