mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-09 06:11:54 +02:00
Add test for direction parsing.
This commit is contained in:
parent
f6d5161390
commit
cb776abfd9
1 changed files with 12 additions and 1 deletions
|
@ -3,7 +3,7 @@ Test direction processing.
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from map_machine.direction import DirectionSet, parse_vector
|
from map_machine.direction import DirectionSet, parse_vector, Sector
|
||||||
|
|
||||||
__author__ = "Sergey Vartanov"
|
__author__ = "Sergey Vartanov"
|
||||||
__email__ = "me@enzet.ru"
|
__email__ = "me@enzet.ru"
|
||||||
|
@ -41,3 +41,14 @@ def test_main_direction() -> None:
|
||||||
assert DirectionSet("70").is_right() is True
|
assert DirectionSet("70").is_right() is True
|
||||||
assert DirectionSet("270").is_right() is False
|
assert DirectionSet("270").is_right() is False
|
||||||
assert DirectionSet("180").is_right() is None
|
assert DirectionSet("180").is_right() is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_sector_parsing() -> None:
|
||||||
|
"""Test constructing sector from the string representation."""
|
||||||
|
Sector("0", angle=0)
|
||||||
|
Sector("90", angle=0)
|
||||||
|
Sector("-90", angle=0)
|
||||||
|
|
||||||
|
sector: Sector = Sector("0-180")
|
||||||
|
assert np.allclose(sector.start, [0, -1])
|
||||||
|
assert np.allclose(sector.end, [0, 1])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue