test_voronoi.py 901 B

1234567891011121314151617181920212223242526
  1. """
  2. Test cases for Voronoi Diagram creation.
  3. Overall, I'm trying less to test the correctness of the result
  4. and more to cover input cases and behavior, making sure
  5. that we return a sane result without error or raise a useful one.
  6. """
  7. import pytest
  8. from shapely.geos import geos_version
  9. from shapely.wkt import loads as load_wkt
  10. from shapely.ops import voronoi_diagram
  11. requires_geos_35 = pytest.mark.skipif(geos_version < (3, 5, 0), reason='GEOS >= 3.5.0 is required.')
  12. @requires_geos_35
  13. def test_from_multipoint_without_tolerace_with_floating_point_coordinates():
  14. """But it's fine without it."""
  15. mp = load_wkt('MULTIPOINT (20.1273 18.7303, 26.5107 18.7303, 20.1273 23.8437, 26.5107 23.8437)')
  16. regions = voronoi_diagram(mp)
  17. print("Len: %d -> Regions: %s" % (len(regions), str(regions)))
  18. print(geos_version)
  19. test_from_multipoint_without_tolerace_with_floating_point_coordinates()