Skip to content

Commit

Permalink
tests/subclass: Check that instances of the subclass can be copied
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud committed Apr 15, 2019
1 parent eed7c03 commit b82c907
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_subclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def __new__(cls, x, y, label):
return self


@given(v=vectors(), label_v=st.text())
def test_subclass_copy(v: Vector2, label_v: str):
"""Test that instances of the subclass can be copied."""
from copy import copy, deepcopy
v = LabeledVector(*v, label_v) # type: ignore
w = copy(v)

assert v == w == deepcopy(v)
assert w.label == label_v


@pytest.mark.parametrize("op", BINARY_OPS)
@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):
Expand Down

0 comments on commit b82c907

Please sign in to comment.