def test_is_active_fails(self): """ This method tests that 'run mode' activity does change. The expected result of this test is that the is_active method returns inactivity. """ rm = RunMode("---\n---\n---") for _ in range(0, runmode_config["iterations"]): # For each iteration of the mode's presentation state for _ in range(0, runmode_config["full_frames"]): # For each time presentation state shows a full light display. # Assert the mode is active. assert rm.is_active() rm.get_display_pattern() for _ in range(0, runmode_config["pattern_frames"]): # For each time presentation state shows the user's pattern. # Assert the mode is still active. assert rm.is_active() rm.get_display_pattern() # Assert the mode is no longer active. assert not rm.is_active()
def test_get_display_pattern(self): """ This method tests that the mode is, under all circumstances, returning the correct pattern to be displayed. The circumstances are as follows: - Two patterns during presentation state; a full light display, and the cells of the user's pattern. - Once presentation state has finished, the player's pattern as it plays out on the display. """ input = "-*-\n-*-\n-*-" rm = RunMode(input) for _ in range(0, runmode_config["iterations"]): # For each iteration of the mode's presentation state for _ in range(0, runmode_config["full_frames"]): # For each time the presentation state shows a full light display # Assert that the presentation state is showing a full light display assert rm.get_display_pattern() == "***\n***\n***" for _ in range(0, runmode_config["pattern_frames"]): # For each time the presentation state shows the user's pattern. # Assert that the presentation state is showing the user's pattern assert rm.get_display_pattern() == input # Assert that the mode is showing the user's pattern assert rm.get_display_pattern() == input
def test_is_active(self): """ This method tests that 'run mode' is still active, especially in it's presentation state. The expected result of this test is for the check to show the mode is still active. """ rm = RunMode("-*-\n-*-\n-*-") for _ in range(0, runmode_config["iterations"]): # For each iteration of the mode's presentation state. for _ in range(0, runmode_config["full_frames"]): # For each time presentation state shows a full light display. # Assert the mode is still active. assert rm.is_active() rm.get_display_pattern() for _ in range(0, runmode_config["pattern_frames"]): # For each time presentation state shows the user's pattern # Assert the mode is still active assert rm.is_active() rm.get_display_pattern() # Once presentation state, assert the mode is still active. assert rm.is_active() rm.get_display_pattern() # Assert the mode is still active once the user's pattern has started running. assert rm.is_active()