Refactor figures; get use of Python 3.9 features.

This commit is contained in:
Sergey Vartanov 2021-08-18 08:38:33 +03:00
parent 053324451a
commit 3bcf026862
36 changed files with 698 additions and 750 deletions

View file

@ -1,8 +1,6 @@
"""
Test label generation for nodes.
"""
from typing import List, Set
from roentgen.text import Label
from test import SCHEME
@ -10,18 +8,14 @@ __author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
def construct_labels(tags) -> List[Label]:
"""
Construct labels from OSM node tags.
"""
processed: Set[str] = set()
def construct_labels(tags) -> 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.
"""
"""Test tags that should be converted into single label."""
labels = construct_labels({"name": "Name"})
assert len(labels) == 1
assert labels[0].text == "Name"
@ -37,9 +31,7 @@ def test_1_label_unknown_tags() -> None:
def test_2_labels() -> None:
"""
Test tags that should be converted into two labels.
"""
"""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"