test_group.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_square_group_with_wrong_side_type(prepare_videogame):
  21. with pytest.raises(TypeError):
  22. SquareGroup(protagonist, 'foo')
  23. def test_square_group_with_side_out_of_range(prepare_videogame):
  24. with pytest.raises(ValueError):
  25. SquareGroup(protagonist, -1)
  26. def test_stairs_group_with_wrong_steps_type(prepare_videogame):
  27. with pytest.raises(TypeError):
  28. StairsGroup(protagonist, 'foo')
  29. def test_stairs_group_with_steps_out_of_range(prepare_videogame):
  30. with pytest.raises(ValueError):
  31. StairsGroup(protagonist, -1)
  32. def test_stairs_group_with_horizontal_and_vertical_flip_wrong_type(
  33. prepare_videogame,
  34. ):
  35. with pytest.raises(TypeError):
  36. StairsGroup(protagonist, 3, 'foo', 'bar')