I am new to python coding and need some help with unit testing. I want to test my modules that move the images location in Pygame based on what the user has pressed. Here are my modules:
def moveRight(self):
self.x = self.x + self.speed
def moveLeft(self):
self.x = self.x - self.speed
Here is where i call these modules:
def on_execute(self):
# While game is running
while( self._running ):
pygame.event.pump()
keys = pygame.key.get_pressed()
if (keys[K_RIGHT]):
self.player.moveRight()
if (keys[K_LEFT]):
self.player.moveLeft()
# Use class players function moveUp to move up
if (keys[K_UP]):
self.player.moveUp()
self.on_render()
How do i go about testing these? is unit testing different when working with Pygame?