Last active
November 7, 2020 19:34
-
-
Save gidgid/4de576a0c9b7c217e076619d412825d5 to your computer and use it in GitHub Desktop.
Nested dictionaries make us coupled to the internal structure
This file contains hidden or 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_hobbies_names_is_reliant_on_hobbies_to_have_names(): | |
employee = { | |
"name": "John", | |
"age": 42, | |
"hobbies": [ | |
{"name": "Rock Climbing", "_id": "1234"}, | |
{"name": "Acrobatics", "_id": "5678"}, | |
], | |
} | |
hobbies_names = {hobby["name"] for hobby in employee["hobbies"]} | |
assert hobbies_names == {"Rock Climbing", "Acrobatics"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment