File: test_models.py

package info (click to toggle)
python-opensky 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: python: 859; sh: 5; makefile: 4
file content (33 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
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
"""Tests for the OpenSky Library."""

import pytest

from python_opensky import BoundingBox
from python_opensky.exceptions import OpenSkyCoordinateError


def test_degrees() -> None:
    """Test if validation passes."""
    box: BoundingBox = BoundingBox(
        min_latitude=0,
        max_latitude=0,
        min_longitude=0,
        max_longitude=0,
    )
    box.validate()
    box = BoundingBox(
        min_latitude=-91,
        max_latitude=0,
        min_longitude=0,
        max_longitude=0,
    )
    with pytest.raises(OpenSkyCoordinateError):
        box.validate()
    box = BoundingBox(
        min_latitude=0,
        max_latitude=0,
        min_longitude=-181,
        max_longitude=0,
    )
    with pytest.raises(OpenSkyCoordinateError):
        box.validate()