| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import pygame
- import pytest
- from jogai import character
- from jogai import videogame as vg
- from jogai.translations import gettext as _
- def test_height_is_a_non_negative_integer(prepare_videogame):
- assert protagonist.height > -1
- def test_width_is_a_non_negative_integer(prepare_videogame):
- assert protagonist.width > -1
- def test_x_coordinate_is_an_integer(prepare_videogame):
- assert isinstance(protagonist.x, int)
- def test_y_coordinate_is_an_integer(prepare_videogame):
- assert isinstance(protagonist.y, int)
- def test_wrong_character_name():
- with pytest.raises(TypeError):
- ch = character.Character('protagonist.png', 1)
- def test_repr_character(prepare_videogame):
- print(protagonist.__repr__)
- def test_wrong_predefined_keys_type():
- with pytest.raises(TypeError):
- ch = character.Character('protagonist.png', predefined_keys=[])
- def test_move_with_wrong_coordinates(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.move('foo', 'bar')
- def test_move_with_wrong_key(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.move(5, 3, 1)
- def test_scale_with_wrong_factor_type(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.scale_to('foo')
- def test_scale_with_a_negative_factor(prepare_videogame):
- with pytest.raises(ValueError):
- protagonist.scale_to(-1)
- def test_set_height_with_wrong_type(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.set_height('foo')
- def test_set_height_with_a_negative_amount(prepare_videogame):
- with pytest.raises(ValueError):
- protagonist.set_height(-1)
- def test_set_position_with_wrong_types(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.set_position('foo', 'bar')
- def test_set_width_with_wrong_type(prepare_videogame):
- with pytest.raises(TypeError):
- protagonist.set_width('a')
- def test_set_width_with_a_negative_amount(prepare_videogame):
- with pytest.raises(ValueError):
- protagonist.set_width(-1)
|