import pytest
from aimaPy.grid import *

compare = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])


def test_distance():
    assert distance((1, 2), (5, 5)) == 5.0


def test_distance_squared():
    assert distance_squared((1, 2), (5, 5)) == 25.0


def test_clip():
    list_ = [clip(x, 0, 1) for x in [-1, 0.5, 10]]
    res = [0, 0.5, 1]

    assert compare(list_, res)


def test_vector_clip():
    assert vector_clip((-1, 10), (0, 0), (9, 9)) == (0, 9)

if __name__ == '__main__':
    pytest.main()

import pytest
from aimaPy.grid import *

compare_list = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])


def test_distance():
    assert distance((1, 2), (5, 5)) == 5.0


def test_distance_squared():
    assert distance_squared((1, 2), (5, 5)) == 25.0


def test_clip():
    list_ = [clip(x, 0, 1) for x in [-1, 0.5, 10]]
    res = [0, 0.5, 1]

    assert compare_list(list_, res)


def test_vector_clip():
    assert vector_clip((-1, 10), (0, 0), (9, 9)) == (0, 9)

if __name__ == '__main__':
    pytest.main()

Change name of compare function in test grid
Change name of compare function in test grid

  import pytest
  from aimaPy.grid import *
  
- compare = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])
+ compare_list = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])
  
  
  def test_distance():
      assert distance((1, 2), (5, 5)) == 5.0
  
  
  def test_distance_squared():
      assert distance_squared((1, 2), (5, 5)) == 25.0
  
  
  def test_clip():
      list_ = [clip(x, 0, 1) for x in [-1, 0.5, 10]]
      res = [0, 0.5, 1]
  
-     assert compare(list_, res)
+     assert compare_list(list_, res)
  
  
  def test_vector_clip():
      assert vector_clip((-1, 10), (0, 0), (9, 9)) == (0, 9)
  
  if __name__ == '__main__':
      pytest.main()
  
Change name of compare function in test grid
## Code Before:
import pytest
from aimaPy.grid import *

compare = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])


def test_distance():
    assert distance((1, 2), (5, 5)) == 5.0


def test_distance_squared():
    assert distance_squared((1, 2), (5, 5)) == 25.0


def test_clip():
    list_ = [clip(x, 0, 1) for x in [-1, 0.5, 10]]
    res = [0, 0.5, 1]

    assert compare(list_, res)


def test_vector_clip():
    assert vector_clip((-1, 10), (0, 0), (9, 9)) == (0, 9)

if __name__ == '__main__':
    pytest.main()

## Instruction:
Change name of compare function in test grid
## Code After:
import pytest
from aimaPy.grid import *

compare_list = lambda x, y: all([elm_x == y[i] for i, elm_x in enumerate(x)])


def test_distance():
    assert distance((1, 2), (5, 5)) == 5.0


def test_distance_squared():
    assert distance_squared((1, 2), (5, 5)) == 25.0


def test_clip():
    list_ = [clip(x, 0, 1) for x in [-1, 0.5, 10]]
    res = [0, 0.5, 1]

    assert compare_list(list_, res)


def test_vector_clip():
    assert vector_clip((-1, 10), (0, 0), (9, 9)) == (0, 9)

if __name__ == '__main__':
    pytest.main()
