test_make_valid.py 479 B

123456789101112131415
  1. from shapely.geometry import Polygon
  2. from shapely.validation import make_valid
  3. def test_make_valid_invalid_input():
  4. geom = Polygon([(0, 0), (0, 2), (1, 1), (2, 2), (2, 0), (1, 1), (0, 0)])
  5. valid = make_valid(geom)
  6. assert len(valid.geoms) == 2
  7. assert all(geom.geom_type == "Polygon" for geom in valid.geoms)
  8. def test_make_valid_input():
  9. geom = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])
  10. valid = make_valid(geom)
  11. assert id(valid) == id(geom)