Last active
October 4, 2020 08:44
-
-
Save gidgid/aae07e53c1b784da3fd0b421f9d3dad0 to your computer and use it in GitHub Desktop.
Camelcase names are weird in Python
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
from pydantic import BaseModel | |
class Item(BaseModel): | |
id: str # 1 | |
isAvailable: bool # 2 | |
def test_does_it_look_pythonic_to_you(): | |
item = Item(id='test-item-id', isAvailable=True) # 3 | |
assert item.isAvailable is True # 3 | |
external_input = {'id': 'new-test-id', 'isAvailable': False} | |
item = Item(**external_input) # 4 | |
assert item.isAvailable is False # 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment