Skip to content

Commit

Permalink
tests/ctor: Generalize copy test to (simple) Vector2 subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud committed Apr 15, 2019
1 parent dbce3f6 commit f378e75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_vector2_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ def test_ctor_pickle(cls, v: Vector2):
assert isinstance(w, cls)


@pytest.mark.parametrize("cls", [Vector2, V])
@given(v=vectors())
def test_ctor_copy(v: Vector2):
def test_ctor_copy(cls, v: Vector2):
"""Test that Vector2 instances can be copied."""
from copy import copy, deepcopy
v = cls(v)

assert v == copy(v) == deepcopy(v)
assert isinstance(copy(v), cls)
assert isinstance(deepcopy(v), cls)

0 comments on commit f378e75

Please sign in to comment.