test_group.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import pytest
  2. from jogai import *
  3. def test_random_group_with_amount_wrong_type(prepare_videogame):
  4. with pytest.raises(TypeError):
  5. RandomGroup(protagonist, 'foo', (0, 200), (0, 200))
  6. def test_random_group_with_ranges_wrong_type(prepare_videogame):
  7. with pytest.raises(TypeError):
  8. RandomGroup(protagonist, 2, 'bar', 'foo')
  9. def test_random_group_with_amount_not_greater_than_1(prepare_videogame):
  10. with pytest.raises(ValueError):
  11. RandomGroup(protagonist, -1, (0, 200), (0, 200))
  12. def test_random_group_with_wrong_length_ranges(prepare_videogame):
  13. with pytest.raises(ValueError):
  14. RandomGroup(protagonist, 3, (1, 2, 3), (1, 2, 3))
  15. def test_random_group_with_min_greater_than_max_range(prepare_videogame):
  16. with pytest.raises(ValueError):
  17. RandomGroup(protagonist, 3, (100, 3), (100, 3))
  18. def test_random_group_with_lists(prepare_videogame):
  19. RandomGroup(protagonist, 3, [0, 200], [0, 200])
  20. def test_rectangle_group_with_wrong_sides_type(prepare_videogame):
  21. with pytest.raises(TypeError):
  22. RectangleGroup(protagonist, 'foo', 'bar')
  23. def test_rectangle_group_with_sides_out_of_range(prepare_videogame):
  24. with pytest.raises(ValueError):
  25. RectangleGroup(protagonist, -1, 3)
  26. def test_rectangle_group_with_both_sides_equal_to_1(prepare_videogame):
  27. with pytest.raises(ValueError):
  28. RectangleGroup(protagonist, 1, 1)
  29. def test_square_group_with_wrong_side_type(prepare_videogame):
  30. with pytest.raises(TypeError):
  31. SquareGroup(protagonist, 'foo')
  32. def test_square_group_with_side_out_of_range(prepare_videogame):
  33. with pytest.raises(ValueError):
  34. SquareGroup(protagonist, -1)
  35. def test_stairs_group_with_wrong_steps_type(prepare_videogame):
  36. with pytest.raises(TypeError):
  37. StairsGroup(protagonist, 'foo')
  38. def test_stairs_group_with_steps_out_of_range(prepare_videogame):
  39. with pytest.raises(ValueError):
  40. StairsGroup(protagonist, -1)
  41. def test_stairs_group_with_horizontal_and_vertical_flip_wrong_type(
  42. prepare_videogame,
  43. ):
  44. with pytest.raises(TypeError):
  45. StairsGroup(protagonist, 3, 'foo', 'bar')