Last active
October 31, 2020 16:23
-
-
Save goujonbe/4acfd9ad1c0a51dcc690ec59eceaaabf to your computer and use it in GitHub Desktop.
Gist that is part of a tutorial on Pytest features.
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
def test_translate_animal_names(caplog): | |
animals_in_french = ["lapin", "grenouille", "cheval"] | |
french_english_translation = { | |
"lapin": "rabbit", | |
"cheval": "horse" | |
} | |
animals_in_english = translate_animal_names( | |
animals_in_french, | |
french_english_translation | |
) | |
assert animals_in_english == ["rabbit", "horse"] | |
assert caplog.record_tuples == [ | |
( | |
"root", | |
logging.WARNING, | |
"'grenouille' is not present in the translations provided." | |
) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment