from hypothesis import given
import pytest  # type: ignore

from ppb_vector import Vector
from utils import vectors


@pytest.fixture()
def vector():
    return Vector(10, 20)


def test_class_member_access(vector):
    assert vector.x == 10
    assert vector.y == 20


@given(v=vectors())
def test_index_access(v: Vector):
    assert v[0] == v.x
    assert v[1] == v.y


@given(v=vectors())
def test_key_access(v: Vector):
    assert v["x"] == v.x
    assert v["y"] == v.y

from hypothesis import given

from ppb_vector import Vector
from utils import floats, vectors


@given(x=floats(), y=floats())
def test_class_member_access(x: float, y: float):
    v = Vector(x, y)
    assert v.x == x
    assert v.y == y


@given(v=vectors())
def test_index_access(v: Vector):
    assert v[0] == v.x
    assert v[1] == v.y


@given(v=vectors())
def test_key_access(v: Vector):
    assert v["x"] == v.x
    assert v["y"] == v.y

Make member_access into an Hypothesis test
tests/member_access: Make member_access into an Hypothesis test

  from hypothesis import given
- import pytest  # type: ignore
  
  from ppb_vector import Vector
- from utils import vectors
+ from utils import floats, vectors
  
  
+ @given(x=floats(), y=floats())
- @pytest.fixture()
- def vector():
-     return Vector(10, 20)
- 
- 
- def test_class_member_access(vector):
+ def test_class_member_access(x: float, y: float):
+     v = Vector(x, y)
-     assert vector.x == 10
+     assert v.x == x
-     assert vector.y == 20
+     assert v.y == y
  
  
  @given(v=vectors())
  def test_index_access(v: Vector):
      assert v[0] == v.x
      assert v[1] == v.y
  
  
  @given(v=vectors())
  def test_key_access(v: Vector):
      assert v["x"] == v.x
      assert v["y"] == v.y
  
Make member_access into an Hypothesis test
## Code Before:
from hypothesis import given
import pytest  # type: ignore

from ppb_vector import Vector
from utils import vectors


@pytest.fixture()
def vector():
    return Vector(10, 20)


def test_class_member_access(vector):
    assert vector.x == 10
    assert vector.y == 20


@given(v=vectors())
def test_index_access(v: Vector):
    assert v[0] == v.x
    assert v[1] == v.y


@given(v=vectors())
def test_key_access(v: Vector):
    assert v["x"] == v.x
    assert v["y"] == v.y

## Instruction:
Make member_access into an Hypothesis test
## Code After:
from hypothesis import given

from ppb_vector import Vector
from utils import floats, vectors


@given(x=floats(), y=floats())
def test_class_member_access(x: float, y: float):
    v = Vector(x, y)
    assert v.x == x
    assert v.y == y


@given(v=vectors())
def test_index_access(v: Vector):
    assert v[0] == v.x
    assert v[1] == v.y


@given(v=vectors())
def test_key_access(v: Vector):
    assert v["x"] == v.x
    assert v["y"] == v.y
