[test] refactor tests
This commit is contained in:
parent
51c7fa9add
commit
4d57936da8
31 changed files with 1735 additions and 2032 deletions
17
masque/test/test_manhattanize.py
Normal file
17
masque/test/test_manhattanize.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import pytest
|
||||
import numpy
|
||||
|
||||
from ..shapes import Polygon
|
||||
|
||||
|
||||
def test_manhattanize() -> None:
|
||||
pytest.importorskip("float_raster")
|
||||
pytest.importorskip("skimage.measure")
|
||||
poly = Polygon([[0, 5], [5, 10], [10, 5], [5, 0]])
|
||||
grid = numpy.arange(0, 11, 1)
|
||||
|
||||
manhattan_polys = poly.manhattanize(grid, grid)
|
||||
assert len(manhattan_polys) >= 1
|
||||
for mp in manhattan_polys:
|
||||
dv = numpy.diff(mp.vertices, axis=0)
|
||||
assert numpy.all((dv[:, 0] == 0) | (dv[:, 1] == 0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue