Skip to content
Snippets Groups Projects
Commit 74aaf077 authored by DannyAbdi's avatar DannyAbdi
Browse files

Created test class for Player class

parent d41bde7f
Branches
Tags
Loading
import unittest
from unittest.mock import Mock, patch
from config import TILE_SIZE
from player import Player
class TestPlayer(unittest.TestCase):
@patch('pygame.draw.rect')
def test_draw(self, mock_rect):
# Mock the screen surface
screen_surface_mock = Mock()
player = Player(10, 20)
player.draw(screen_surface_mock)
mock_rect.assert_called_once_with(screen_surface_mock, 'white', (10, 20, TILE_SIZE, TILE_SIZE))
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment