-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathtest_enums.py
41 lines (25 loc) · 1.35 KB
/
test_enums.py
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
"""Tests for the enumerated types used by TIAToolbox."""
import pytest
from tiatoolbox.enums import GeometryType
def test_geometrytype_missing() -> None:
"""Test that GeometryType.MISSING is returned when given None."""
with pytest.raises(ValueError, match="not a valid GeometryType"):
GeometryType(None)
def test_geometrytype_point_from_string() -> None:
"""Init GeometryType.POINT from string."""
assert GeometryType("Point") == GeometryType.POINT
def test_geometrytype_linestring_from_string() -> None:
"""Init GeometryType.LINE_STRING from string."""
assert GeometryType("LineString") == GeometryType.LINE_STRING
def test_geometrytype_polygon_from_string() -> None:
"""Init GeometryType.POLYGON from string."""
assert GeometryType("Polygon") == GeometryType.POLYGON
def test_geometrytype_multipoint_from_string() -> None:
"""Init GeometryType.MULTI_POINT from string."""
assert GeometryType("MultiPoint") == GeometryType.MULTI_POINT
def test_geometrytype_multilinestring_from_string() -> None:
"""Init GeometryType.MULTI_LINE_STRING from string."""
assert GeometryType("MultiLineString") == GeometryType.MULTI_LINE_STRING
def test_geometrytype_multipolygon_from_string() -> None:
"""Init GeometryType.MULTI_POLYGON from string."""
assert GeometryType("MultiPolygon") == GeometryType.MULTI_POLYGON