mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-16 08:06:16 +02:00
Rename test to tests; fix equator length.
This commit is contained in:
parent
f744c601d0
commit
ba26c1d4d7
19 changed files with 71 additions and 33 deletions
38
tests/test_label.py
Normal file
38
tests/test_label.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
Test label generation for nodes.
|
||||
"""
|
||||
from roentgen.text import Label
|
||||
from tests import SCHEME
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
|
||||
def construct_labels(tags: dict[str, str]) -> list[Label]:
|
||||
"""Construct labels from OSM node tags."""
|
||||
processed: set[str] = set()
|
||||
return SCHEME.construct_text(tags, "all", processed)
|
||||
|
||||
|
||||
def test_1_label() -> None:
|
||||
"""Test tags that should be converted into single label."""
|
||||
labels = construct_labels({"name": "Name"})
|
||||
assert len(labels) == 1
|
||||
assert labels[0].text == "Name"
|
||||
|
||||
|
||||
def test_1_label_unknown_tags() -> None:
|
||||
"""
|
||||
Test tags with some unknown tags that should be converted into single label.
|
||||
"""
|
||||
labels = construct_labels({"name": "Name", "aaa": "bbb"})
|
||||
assert len(labels) == 1
|
||||
assert labels[0].text == "Name"
|
||||
|
||||
|
||||
def test_2_labels() -> None:
|
||||
"""Test tags that should be converted into two labels."""
|
||||
labels = construct_labels({"name": "Name", "ref": "5"})
|
||||
assert len(labels) == 2
|
||||
assert labels[0].text == "Name"
|
||||
assert labels[1].text == "5"
|
Loading…
Add table
Add a link
Reference in a new issue