예제 #1
0
    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()
예제 #2
0
    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()