File: test_bbox.py

package info (click to toggle)
antimeridian 0.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,948 kB
  • sloc: python: 1,165; sh: 8; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (2)
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
from typing import List

import pytest

import antimeridian

from .conftest import Reader


@pytest.mark.parametrize(
    "name,expected",
    [
        ("simple", [90, 40, 100, 50]),
        ("split", [170, 40, -170, 50]),
        ("multi-no-antimeridian", [90, 10, 100, 50]),
        ("north-pole", [-180, 40, 180, 90]),
        ("ocean", [-180, -85.609, 180, 90]),
    ],
)
def test_bbox(read_output: Reader, name: str, expected: List[float]) -> None:
    shape = read_output(name)
    bbox = antimeridian.bbox(shape)
    assert bbox == expected


def test_bbox_force_over_antimeridian(read_output: Reader) -> None:
    expected = [
        179.96779787822723,
        -19.044135782844712,
        -179.77058698198195,
        -18.555752850452095,
    ]
    shape = read_output("issues-134")
    bbox = antimeridian.bbox(shape, force_over_antimeridian=True)
    assert bbox == expected