Skip to content

Commit

Permalink
add unit test for AttrDict with from reserved keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Sep 9, 2024
1 parent 892d1af commit 87c2aa4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,12 @@ def test_attrlist_to_list() -> None:
l = utils.AttrList[Any]([{}, {}]).to_list()
assert isinstance(l, list)
assert l == [{}, {}]


def test_attrdict_with_reserved_keyword() -> None:
d = utils.AttrDict({"from": 10, "size": 20})
assert d.from_ == 10
assert d.size == 20
d = utils.AttrDict({})
d.from_ = 10
assert {"from": 10} == d.to_dict()

0 comments on commit 87c2aa4

Please sign in to comment.