mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-04 20:56: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.scheme import Scheme
|
||||
|
||||
SCHEME: Scheme = Scheme("scheme/default.yml")
|
||||
ICON_EXTRACTOR: ShapeExtractor = ShapeExtractor(
|
||||
"icons/icons.svg", Path("icons/config.json")
|
||||
)
|
||||
|
||||
|
||||
def test_icons() -> None:
|
||||
""" Test grid drawing. """
|
||||
|
@ -19,11 +24,7 @@ def test_icons() -> None:
|
|||
|
||||
|
||||
def get_icon(tags: Dict[str, str]):
|
||||
scheme = Scheme("scheme/default.yml")
|
||||
icon_extractor = ShapeExtractor(
|
||||
"icons/icons.svg", Path("icons/config.json")
|
||||
)
|
||||
icon, _ = scheme.get_icon(icon_extractor, tags)
|
||||
icon, _ = SCHEME.get_icon(ICON_EXTRACTOR, tags)
|
||||
return icon
|
||||
|
||||
|
||||
|
|
|
@ -8,13 +8,14 @@ from typing import List
|
|||
from roentgen.scheme import Scheme
|
||||
from roentgen.text import Label
|
||||
|
||||
SCHEME: Scheme = Scheme("scheme/default.yml")
|
||||
|
||||
|
||||
def construct_labels(tags) -> List[Label]:
|
||||
"""
|
||||
Construct labels from OSM node tags.
|
||||
"""
|
||||
scheme = Scheme("scheme/default.yml")
|
||||
return scheme.construct_text(tags, True)
|
||||
return SCHEME.construct_text(tags, "all")
|
||||
|
||||
|
||||
def test_1_label() -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue