Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 8, 2025
1 parent d5dce02 commit a572cca
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/test_typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ def test_typed_init():
class MyTypedArray(TypedArray[bool]):
type: bool


class MyTypedMap0(TypedMap):
k0: bool


class MyTypedMap1(TypedMap):
key0: str
key1: int
key2: MyTypedMap0
key3: Array[int]
key4: str | int


class MySubTypedDoc(TypedDoc):
my_typed_map: MyTypedMap1


class MyTypedDoc(MySubTypedDoc):
my_array: MyTypedArray

Expand Down Expand Up @@ -72,17 +76,11 @@ def test_typed():

with pytest.raises(AttributeError) as excinfo:
my_typed_doc.my_typed_map.wrong_key = "foo"
assert (
str(excinfo.value)
== '"<class \'test_typed.MyTypedMap1\'>" has no attribute "wrong_key"'
)
assert str(excinfo.value) == '"<class \'test_typed.MyTypedMap1\'>" has no attribute "wrong_key"'

with pytest.raises(AttributeError) as excinfo:
my_typed_doc.my_typed_map.wrong_key
assert (
str(excinfo.value)
== '"<class \'test_typed.MyTypedMap1\'>" has no attribute "wrong_key"'
)
assert str(excinfo.value) == '"<class \'test_typed.MyTypedMap1\'>" has no attribute "wrong_key"'

assert len(my_typed_doc.my_array) == 0
my_typed_doc.my_array.append(True)
Expand Down

0 comments on commit a572cca

Please sign in to comment.