Skip to content

Instantly share code, notes, and snippets.

@goujonbe
Last active October 31, 2020 16:23
Show Gist options
  • Select an option

  • Save goujonbe/29a9c4781f536c2b8423697f03a5dbfc to your computer and use it in GitHub Desktop.

Select an option

Save goujonbe/29a9c4781f536c2b8423697f03a5dbfc to your computer and use it in GitHub Desktop.
Gist that is part of a tutorial on pytest features. About logging testing.
def translate_animal_names(
animals: List[str],
translations: Dict[str, str]
) -> List[str]:
translated_animal_names = []
for animal in animals:
if animal in translations:
translated_animal_names.append(translations[animal])
else:
logging.warning(
"'%s' is not present in the translations provided.",
animal
)
return translated_animal_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment