| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- # jogai - Python Game Library
- #
- # This library is free software; you can redistribute it and/or
- # modify it under the terms of the GNU Library General Public
- # License as published by the Free Software Foundation; either
- # version 2 of the License, or (at your option) any later version.
- #
- # This library is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Library General Public License for more details.
- #
- # You should have received a copy of the GNU Library General Public
- # License along with this library; if not, write to the Free
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- #
- # Ramón Palleiro Rodríguez
- # Zero! Factorial Studio
- # info@zero.gal
- import pytest
- from jogai import *
- def test_random_group_with_amount_wrong_type(prepare_videogame):
- with pytest.raises(TypeError):
- RandomGroup(protagonist, 'foo', (0, 200), (0, 200))
- def test_random_group_with_ranges_wrong_type(prepare_videogame):
- with pytest.raises(TypeError):
- RandomGroup(protagonist, 2, 'bar', 'foo')
- def test_random_group_with_amount_not_greater_than_1(prepare_videogame):
- with pytest.raises(ValueError):
- RandomGroup(protagonist, -1, (0, 200), (0, 200))
- def test_random_group_with_wrong_length_ranges(prepare_videogame):
- with pytest.raises(ValueError):
- RandomGroup(protagonist, 3, (1, 2, 3), (1, 2, 3))
- def test_random_group_with_min_greater_than_max_range(prepare_videogame):
- with pytest.raises(ValueError):
- RandomGroup(protagonist, 3, (100, 3), (100, 3))
- def test_random_group_with_lists(prepare_videogame):
- RandomGroup(protagonist, 3, [0, 200], [0, 200])
- def test_rectangle_group_with_wrong_sides_type(prepare_videogame):
- with pytest.raises(TypeError):
- RectangleGroup(protagonist, 'foo', 'bar')
- def test_rectangle_group_with_sides_out_of_range(prepare_videogame):
- with pytest.raises(ValueError):
- RectangleGroup(protagonist, -1, 3)
- def test_rectangle_group_with_both_sides_equal_to_1(prepare_videogame):
- with pytest.raises(ValueError):
- RectangleGroup(protagonist, 1, 1)
- def test_square_group_with_wrong_side_type(prepare_videogame):
- with pytest.raises(TypeError):
- SquareGroup(protagonist, 'foo')
- def test_square_group_with_side_out_of_range(prepare_videogame):
- with pytest.raises(ValueError):
- SquareGroup(protagonist, -1)
- def test_stairs_group_with_wrong_steps_type(prepare_videogame):
- with pytest.raises(TypeError):
- StairsGroup(protagonist, 'foo')
- def test_stairs_group_with_steps_out_of_range(prepare_videogame):
- with pytest.raises(ValueError):
- StairsGroup(protagonist, -1)
- def test_stairs_group_with_horizontal_and_vertical_flip_wrong_type(
- prepare_videogame,
- ):
- with pytest.raises(TypeError):
- StairsGroup(protagonist, 3, 'foo', 'bar')
|