Skip to content

Commit

Permalink
Added extra test for unpacking assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Mar 15, 2023
1 parent 188e002 commit 84331cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/dummymodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,14 @@ def unpacking_assign() -> Tuple[int, str]:
x: int
x, y = (1, "foo")
return x, y


@typechecked
def unpacking_assign_generator() -> Tuple[int, str]:
def genfunc():
yield 1
yield "foo"

x: int
x, y = genfunc()
return x, y
4 changes: 4 additions & 0 deletions tests/test_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,7 @@ def test_augmented_assign(dummymodule):

def test_unpacking_assign(dummymodule):
assert dummymodule.unpacking_assign() == (1, "foo")


def test_unpacking_assign_from_generator(dummymodule):
assert dummymodule.unpacking_assign_generator() == (1, "foo")

0 comments on commit 84331cd

Please sign in to comment.