Skip to content

Commit

Permalink
tests/subvlass: Work around mypy being unable to typecheck this
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud committed Apr 15, 2019
1 parent 84f241e commit eed7c03
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_subclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __new__(cls, x, y, label):
@given(v=vectors(), label_v=st.text(), w=units(), label_w=st.text())
def test_subclass_binops_both(op, v: Vector2, label_v: str, w: Vector2, label_w: str):
"""Test that binary operators preserve attributes when applied to another LabelledVector."""
v = LabeledVector(*v, label_v)
w = LabeledVector(*w, label_w)
v = LabeledVector(*v, label_v) # type: ignore
w = LabeledVector(*w, label_w) # type: ignore
u = op(v, w)

assert isinstance(u, LabeledVector)
Expand All @@ -34,7 +34,7 @@ def test_subclass_binops_both(op, v: Vector2, label_v: str, w: Vector2, label_w:
@given(v=vectors(), label=st.text(), w=units())
def test_subclass_binops_one(op, v: Vector2, label: str, w: Vector2):
"""Test that binary operators preserve extra attributes when applied to a Vector2."""
v = LabeledVector(*v, label)
v = LabeledVector(*v, label) # type: ignore
u = op(v, w)

assert isinstance(u, LabeledVector)
Expand All @@ -46,7 +46,7 @@ def test_subclass_binops_one(op, v: Vector2, label: str, w: Vector2):
def test_subclass_scalar(op, v: Vector2, label: str, scalar: float):
"""Test that scalar operators preserve extra attributes."""
assume(scalar != 0 and v.length != 0)
v = LabeledVector(*v, label)
v = LabeledVector(*v, label) # type: ignore
u = op(v, scalar)

assert isinstance(u, LabeledVector)
Expand All @@ -58,7 +58,7 @@ def test_subclass_scalar(op, v: Vector2, label: str, scalar: float):
def test_subclass_unary(op, v: Vector2, label: str):
"""Test that unary operators preserve extra attributes."""
assume(v.length != 0)
v = LabeledVector(*v, label)
v = LabeledVector(*v, label) # type: ignore
u = op(v)

assert isinstance(u, LabeledVector)
Expand Down

0 comments on commit eed7c03

Please sign in to comment.