mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-05 21:26:46 +02:00
Speed up tests.
Load scheme and shape extractor just once for a test group.
This commit is contained in:
parent
1b40087b18
commit
c5bb1529f5
2 changed files with 9 additions and 7 deletions
|
@ -11,6 +11,11 @@ from roentgen.grid import draw_all_icons
|
||||||
from roentgen.icon import ShapeExtractor
|
from roentgen.icon import ShapeExtractor
|
||||||
from roentgen.scheme import Scheme
|
from roentgen.scheme import Scheme
|
||||||
|
|
||||||
|
SCHEME: Scheme = Scheme("scheme/default.yml")
|
||||||
|
ICON_EXTRACTOR: ShapeExtractor = ShapeExtractor(
|
||||||
|
"icons/icons.svg", Path("icons/config.json")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_icons() -> None:
|
def test_icons() -> None:
|
||||||
""" Test grid drawing. """
|
""" Test grid drawing. """
|
||||||
|
@ -19,11 +24,7 @@ def test_icons() -> None:
|
||||||
|
|
||||||
|
|
||||||
def get_icon(tags: Dict[str, str]):
|
def get_icon(tags: Dict[str, str]):
|
||||||
scheme = Scheme("scheme/default.yml")
|
icon, _ = SCHEME.get_icon(ICON_EXTRACTOR, tags)
|
||||||
icon_extractor = ShapeExtractor(
|
|
||||||
"icons/icons.svg", Path("icons/config.json")
|
|
||||||
)
|
|
||||||
icon, _ = scheme.get_icon(icon_extractor, tags)
|
|
||||||
return icon
|
return icon
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,14 @@ from typing import List
|
||||||
from roentgen.scheme import Scheme
|
from roentgen.scheme import Scheme
|
||||||
from roentgen.text import Label
|
from roentgen.text import Label
|
||||||
|
|
||||||
|
SCHEME: Scheme = Scheme("scheme/default.yml")
|
||||||
|
|
||||||
|
|
||||||
def construct_labels(tags) -> List[Label]:
|
def construct_labels(tags) -> List[Label]:
|
||||||
"""
|
"""
|
||||||
Construct labels from OSM node tags.
|
Construct labels from OSM node tags.
|
||||||
"""
|
"""
|
||||||
scheme = Scheme("scheme/default.yml")
|
return SCHEME.construct_text(tags, "all")
|
||||||
return scheme.construct_text(tags, True)
|
|
||||||
|
|
||||||
|
|
||||||
def test_1_label() -> None:
|
def test_1_label() -> None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue