This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
block/description: support OSM's
description
when country lang is k…
…nown
- Loading branch information
1 parent
a78ae14
commit 58f7563
Showing
2 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from idunn.blocks.description import DescriptionBlock | ||
from idunn.places import POI | ||
from .utils import read_fixture | ||
|
||
|
||
def orsay(lang=None): | ||
place = {"properties": {}} | ||
|
||
full = read_fixture("fixtures/orsay_museum.json") | ||
place["administrative_regions"] = full["administrative_regions"] | ||
|
||
key = f"description:{lang}" if lang else "description" | ||
place["properties"][key] = "Le musée d’Orsay est un musée national inauguré en 1986." | ||
|
||
return POI(place) | ||
|
||
|
||
def test_description_block_with_lang(): | ||
assert DescriptionBlock.from_es(orsay(lang="fr"), lang="en") is None | ||
assert DescriptionBlock.from_es(orsay(lang="fr"), lang="fr") == DescriptionBlock( | ||
type="description", | ||
description="Le musée d’Orsay est un musée national inauguré en 1986.", | ||
source="osm", | ||
) | ||
|
||
|
||
def test_description_block_without_lang(): | ||
assert DescriptionBlock.from_es(orsay(), lang="en") is None | ||
assert DescriptionBlock.from_es(orsay(), lang="fr") == DescriptionBlock( | ||
type="description", | ||
description="Le musée d’Orsay est un musée national inauguré en 1986.", | ||
source="osm", | ||
) |