Currently, I'm working on recreating connect four for a portfolio of simple games. I'm also writing unit tests for all the code I can. Some of my code functions though only call other functions, or only draw to the screen...
#EXAMPLES...
def draw_refresh_button_text(self):
font = pygame.font.Font(None, 24)
text = font.render("Refresh", True, self.black)
self.displaysurf.blit(
text,
(
self.refresh_button_rect.centerx-self.refresh_button_rect.centerx/self.refresh_button_rect.y,
self.refresh_button_rect.centery-self.refresh_button_rect.centery/self.refresh_button_rect.x
)
)
def draw_disks(self):
for column in self.grid:
for disk in column:
pygame.draw.ellipse(self.displaysurf, disk['color'], disk['rect'])
#ONLY CALLS OTHER FUNCTIONS...
def get_input(self):
inputmanager.InputManager.get_events()
inputmanager.InputManager.check_for_quit_event()
inputmanager.InputManager.update_keyboard_key_state()
inputmanager.InputManager.get_keyboard_input()
inputmanager.InputManager.update_mouse_button_state()
inputmanager.InputManager.get_mouse_input()
How would I go about writing tests for code like this?
Should code like this even be tested?
Should all code be tested?
I'm using the Python unittest module to test. The code here uses Pygame.