import pytest  # type: ignore
from ppb_vector import Vector2


@pytest.mark.parametrize("x, y, expected", [
    (Vector2(6, 1), 0, Vector2(0, 0)),
    (Vector2(6, 1), 2, Vector2(12, 2)),
    (Vector2(0, 0), 3, Vector2(0, 0)),
    (Vector2(-1.5, 2.4), -2, Vector2(3.0, -4.8)),
    (Vector2(1, 2), 0.1, Vector2(0.1, 0.2))
])
def test_scalar_multiplication(x, y, expected):
    assert x * y == expected

import pytest  # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2


@pytest.mark.parametrize("x, y, expected", [
    (Vector2(6, 1), 0, Vector2(0, 0)),
    (Vector2(6, 1), 2, Vector2(12, 2)),
    (Vector2(0, 0), 3, Vector2(0, 0)),
    (Vector2(-1.5, 2.4), -2, Vector2(3.0, -4.8)),
    (Vector2(1, 2), 0.1, Vector2(0.1, 0.2))
])
def test_scalar_multiplication(x, y, expected):
    assert x * y == expected


@given(
    x=floats(min_value=-1e75, max_value=1e75),
    y=floats(min_value=-1e75, max_value=1e75),
    v=vectors(max_magnitude=1e150)
)
def test_scalar_associative(x: float, y: float, v: Vector2):
    left  = (x * y) * v
    right =  x * (y * v)
    assert left.isclose(right)

Add a test of the associativity of scalar multiplication
Add a test of the associativity of scalar multiplication
