import pytest

from ppb_vector import Vector2

# List of operations that (Vector2, Vector2) -> Vector2
BINOPS = [
    Vector2.__add__,
    Vector2.__sub__,
    Vector2.reflect,
]

# List of operations that (Vector2, Real) -> Vector2
VNUMOPS = [
    Vector2.__mul__,
    Vector2.__rmul__,
    Vector2.rotate,
    Vector2.truncate,
    Vector2.scale,
]

# List of operations that (Vector2) -> Vector2
MONOPS = [
    Vector2.convert,
    Vector2.__neg__,
    Vector2.normalize,
]

@pytest.mark.parametrize('op', BINOPS)
def test_binop_same(op):
    class V(Vector2): pass

    # Normalize for reflect
    a = op(V(1, 2), V(3, 4).normalize())

    assert isinstance(a, V)


@pytest.mark.parametrize('op', BINOPS)
def test_binop_different(op):
    class V1(Vector2): pass
    class V2(Vector2): pass

    # Normalize for reflect
    a = op(V1(1, 2), V2(3, 4).normalize())
    b = op(V2(1, 2), V1(3, 4).normalize())
    assert isinstance(a, (V1, V2))
    assert isinstance(b, (V1, V2))


@pytest.mark.parametrize('op', BINOPS)
def test_binop_subclass(op):
    class V1(Vector2): pass
    class V2(V1): pass

    # Normalize for reflect
    a = op(V1(1, 2), V2(3, 4).normalize())
    b = op(V2(1, 2), V1(3, 4).normalize())
    assert isinstance(a, V2)
    assert isinstance(b, V2)


@pytest.mark.parametrize('op', VNUMOPS)
def test_vnumop(op):
    class V(Vector2): pass
    
    a = op(V(1, 2), 42)

    assert isinstance(a, V)


@pytest.mark.parametrize('op', MONOPS)
def test_monop(op):
    class V(Vector2): pass
    
    a = op(V(1, 2))

    assert isinstance(a, V)

@@ -99,24 +99,28 @@
 tor2%0ABIN
+ARY_
 OPS = %5B%0A
     Vect
@@ -103,32 +103,32 @@
 %0ABINARY_OPS = %5B%0A
-
     Vector2.__ad
@@ -231,19 +231,29 @@
 ector2%0AV
-NUM
+ECTOR_NUMBER_
 OPS = %5B%0A
@@ -406,19 +406,22 @@
 Vector2%0A
-MON
+UNARY_
 OPS = %5B%0A
@@ -514,32 +514,36 @@
 etrize('op', BIN
+ARY_
 OPS)%0Adef test_bi
@@ -710,32 +710,36 @@
 etrize('op', BIN
+ARY_
 OPS)%0Adef test_bi
@@ -1034,16 +1034,20 @@
 op', BIN
+ARY_
 OPS)%0Adef
@@ -1330,19 +1330,29 @@
 ('op', V
-NUM
+ECTOR_NUMBER_
 OPS)%0Adef
@@ -1491,11 +1491,14 @@
 p', 
-MON
+UNARY_
 OPS)

Use more explicit constant names