1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
import pytest
from pyproj.aoi import AreaOfInterest, BBox
def test_backwards_compatible_import_paths():
from pyproj.transformer import ( # noqa: F401 pylint: disable=unused-import
AreaOfInterest,
)
def test_contains():
assert BBox(1, 1, 4, 4).contains(BBox(2, 2, 3, 3))
def test_not_contains():
assert not BBox(1, 1, 4, 4).contains(BBox(2, 2, 5, 5))
def test_intersects():
assert BBox(1, 1, 4, 4).intersects(BBox(2, 2, 5, 5))
def test_not_intersects():
assert not BBox(1, 1, 4, 4).intersects(BBox(10, 10, 20, 20))
@pytest.mark.parametrize("aoi_class", [AreaOfInterest, BBox])
@pytest.mark.parametrize(
"input",
[
(None, None, None, None),
(float("nan"), float("nan"), float("nan"), float("nan")),
(None, 0, 0, 0),
(float("nan"), 0, 0, 0),
(0, None, 0, 0),
(0, float("nan"), 0, 0),
(0, 0, None, 0),
(0, 0, float("nan"), 0),
(0, 0, 0, None),
(0, 0, 0, float("nan")),
],
)
def test_null_input(aoi_class, input):
with pytest.raises(ValueError, match="NaN or None values are not allowed."):
aoi_class(*input)
|