Skip to content

Commit

Permalink
Add str countries attribute test
Browse files Browse the repository at this point in the history
  • Loading branch information
dc-almeida committed Oct 10, 2024
1 parent 49758c1 commit 7dbb77f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- common:
- World
- countries:
- Some region:
countries: Austria
9 changes: 9 additions & 0 deletions tests/test_codelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ def test_region_codelist_nonexisting_country_name():
)


def test_region_codelist_str_country_name():
"""Check that country name as string is validated against `nomenclature.countries`"""
code = RegionCodeList.from_directory(
"region",
MODULE_TEST_DATA_DIR / "region_codelist" / "countries_attribute_str",
)
assert code["Some region"].countries == "Austria"


def test_norway_as_str():
"""guard against casting of 'NO' to boolean `False` by PyYAML or pydantic"""
region = RegionCodeList.from_directory(
Expand Down

0 comments on commit 7dbb77f

Please sign in to comment.