コード例 #1
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testCycleStartsWithExitingAState(self):
        """In some workflows, the cycle we are intertested in can start with a transition into a number of states
            so we measure from the exit of the previous state rather than the arrival at a specific state."""

        history = pd.Series([CREATED_STATE,
                             'queued',
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04',
                                                  '2012-01-05',
                                                  '2012-01-06',
                                                  '2012-01-07',
                                                  '2012-01-08',
                                                  '2012-01-09',
                                                  '2012-01-10',
                                                  '2012-01-11',
                                                  '2012-01-12',
                                                  '2012-01-13']))

        self.assertEquals(cycle_time(history,
                                     after_state='queued'), 11)
コード例 #2
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTime(self):

        history = pd.Series([CREATED_STATE,
                             CREATED_STATE,
                             START_STATE,
                             'pending',
                             'pending',
                             'pending',
                             'Customer Approval',
                             'Customer Approval',
                             'pending',
                             'pending',
                             'Customer Approval',
                             'Customer Approval',
                             'Customer Approval',
                             'Customer Approval',
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04',
                                                  '2012-01-05',
                                                  '2012-01-06',
                                                  '2012-01-07',
                                                  '2012-01-08',
                                                  '2012-01-09',
                                                  '2012-01-10',
                                                  '2012-01-11',
                                                  '2012-01-12',
                                                  '2012-01-13',
                                                  '2012-01-14',
                                                  '2012-01-15']))

        self.assertEquals(cycle_time(history), 13)
コード例 #3
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testCycleEndsWithExitingAState(self):
        """In some workflows, the cycle we are interested in can end with a transition to more than one state so
           we measure to the exit from the last state rather than the arrival at the end state."""

        history = pd.Series([CREATED_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             'pending'],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04',
                                                  '2012-01-05',
                                                  '2012-01-06',
                                                  '2012-01-07',
                                                  '2012-01-08',
                                                  '2012-01-09',
                                                  '2012-01-10',
                                                  '2012-01-11',
                                                  '2012-01-12']))

        self.assertEquals(cycle_time(history, exit_state=START_STATE), 10)
コード例 #4
0
    def testGetCycleTimeIncRepopenedToClosed(self):

        history = pd.Series(
            [START_STATE, END_STATE, REOPENED_STATE, END_STATE],
            index=pd.to_datetime(
                ['2012-01-01', '2012-01-02', '2012-01-03', '2012-01-04']))

        self.assertEquals(cycle_time(history), 4)
コード例 #5
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTimeIsStillOpen(self):

        history = pd.Series([START_STATE,
                             'pending'],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02']))

        self.assertEquals(cycle_time(history), None)
コード例 #6
0
    def testGetCycleTimeWithDropOuts(self):

        history = pd.Series([START_STATE, 'pending', START_STATE, END_STATE],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04'
                            ]))

        self.assertEquals(cycle_time(history), 4)
コード例 #7
0
    def testCycleStartsWithOpen(self):
        """We need to be able to deal with workflows where there is no queue before work actually starts"""

        history = pd.Series(
            ['Open', 'Awaiting Review', 'Reviewing', END_STATE],
            index=pd.to_datetime(
                ['2012-01-01', '2012-01-02', '2012-01-03', '2012-01-04']))

        self.assertEquals(
            cycle_time(history, start_state='Open', end_state='Reviewing'), 3)
コード例 #8
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTimeWithDropOuts(self):

        history = pd.Series([START_STATE,
                             'pending',
                             START_STATE,
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04']))

        self.assertEquals(cycle_time(history), 4)
コード例 #9
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTimeIncRepopenedToClosed(self):

        history = pd.Series([START_STATE,
                             END_STATE,
                             REOPENED_STATE,
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04']))

        self.assertEquals(cycle_time(history), 4)
コード例 #10
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testCycleStartsWithOpen(self):
        """We need to be able to deal with workflows where there is no queue before work actually starts"""

        history = pd.Series(['Open',
                             'Awaiting Review',
                             'Reviewing',
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04']))

        self.assertEquals(cycle_time(history,
                                     start_state='Open',
                                     end_state='Reviewing'), 3)
コード例 #11
0
    def testCycleEndsWithExitingAState(self):
        """In some workflows, the cycle we are interested in can end with a transition to more than one state so
           we measure to the exit from the last state rather than the arrival at the end state."""

        history = pd.Series([
            CREATED_STATE, START_STATE, START_STATE, START_STATE, START_STATE,
            START_STATE, START_STATE, START_STATE, START_STATE, START_STATE,
            START_STATE, 'pending'
        ],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04', '2012-01-05', '2012-01-06',
                                '2012-01-07', '2012-01-08', '2012-01-09',
                                '2012-01-10', '2012-01-11', '2012-01-12'
                            ]))

        self.assertEquals(cycle_time(history, exit_state=START_STATE), 10)
コード例 #12
0
    def testGetCycleTime(self):

        history = pd.Series([
            CREATED_STATE, CREATED_STATE, START_STATE, 'pending', 'pending',
            'pending', 'Customer Approval', 'Customer Approval', 'pending',
            'pending', 'Customer Approval', 'Customer Approval',
            'Customer Approval', 'Customer Approval', END_STATE
        ],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04', '2012-01-05', '2012-01-06',
                                '2012-01-07', '2012-01-08', '2012-01-09',
                                '2012-01-10', '2012-01-11', '2012-01-12',
                                '2012-01-13', '2012-01-14', '2012-01-15'
                            ]))

        self.assertEquals(cycle_time(history), 13)
コード例 #13
0
    def testCycleStartsWithExitingAState(self):
        """In some workflows, the cycle we are intertested in can start with a transition into a number of states
            so we measure from the exit of the previous state rather than the arrival at a specific state."""

        history = pd.Series([
            CREATED_STATE, 'queued', START_STATE, START_STATE, START_STATE,
            START_STATE, START_STATE, START_STATE, START_STATE, START_STATE,
            START_STATE, START_STATE, END_STATE
        ],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04', '2012-01-05', '2012-01-06',
                                '2012-01-07', '2012-01-08', '2012-01-09',
                                '2012-01-10', '2012-01-11', '2012-01-12',
                                '2012-01-13'
                            ]))

        self.assertEquals(cycle_time(history, after_state='queued'), 11)
コード例 #14
0
    def testGetCycleTimeForIncludedStates(self):
        """
        For cases where cycle starts by exiting one or more states and
        ends by entering one or more states we measure the cycle by recording
        number of days in the states we are interested in.
        """

        history = pd.Series([
            CREATED_STATE, 'queued', 'one', 'two', 'two', 'three', 'three',
            'three', END_STATE, 'two', 'four', 'five', END_STATE
        ],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04', '2012-01-05', '2012-01-06',
                                '2012-01-07', '2012-01-08', '2012-01-09',
                                '2012-01-10', '2012-01-11', '2012-01-12',
                                '2012-01-13'
                            ]))

        self.assertEquals(
            cycle_time(history, include_states=['one', 'two', 'three']), 7)
コード例 #15
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTimeForExcludedStates(self):
        """
        Like included states above but expressed as the inverse - i.e. the states
        we are not interested in.
        """

        history = pd.Series([CREATED_STATE,
                             'queued',
                             'one',
                             'two',
                             'two',
                             'three',
                             'three',
                             'three',
                             END_STATE,
                             'two',
                             'four',
                             'five',
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04',
                                                  '2012-01-05',
                                                  '2012-01-06',
                                                  '2012-01-07',
                                                  '2012-01-08',
                                                  '2012-01-09',
                                                  '2012-01-10',
                                                  '2012-01-11',
                                                  '2012-01-12',
                                                  '2012-01-13']))

        self.assertEquals(cycle_time(history,
                                     exclude_states=[CREATED_STATE,
                                                     'queued',
                                                     'four',
                                                     'five',
                                                     END_STATE]), 7)
コード例 #16
0
    def testGetCycleTimeForExcludedStates(self):
        """
        Like included states above but expressed as the inverse - i.e. the states
        we are not interested in.
        """

        history = pd.Series([
            CREATED_STATE, 'queued', 'one', 'two', 'two', 'three', 'three',
            'three', END_STATE, 'two', 'four', 'five', END_STATE
        ],
                            index=pd.to_datetime([
                                '2012-01-01', '2012-01-02', '2012-01-03',
                                '2012-01-04', '2012-01-05', '2012-01-06',
                                '2012-01-07', '2012-01-08', '2012-01-09',
                                '2012-01-10', '2012-01-11', '2012-01-12',
                                '2012-01-13'
                            ]))

        self.assertEquals(
            cycle_time(history,
                       exclude_states=[
                           CREATED_STATE, 'queued', 'four', 'five', END_STATE
                       ]), 7)
コード例 #17
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetCycleTimeForIncludedStates(self):
        """
        For cases where cycle starts by exiting one or more states and
        ends by entering one or more states we measure the cycle by recording
        number of days in the states we are interested in.
        """

        history = pd.Series([CREATED_STATE,
                             'queued',
                             'one',
                             'two',
                             'two',
                             'three',
                             'three',
                             'three',
                             END_STATE,
                             'two',
                             'four',
                             'five',
                             END_STATE],
                            index=pd.to_datetime(['2012-01-01',
                                                  '2012-01-02',
                                                  '2012-01-03',
                                                  '2012-01-04',
                                                  '2012-01-05',
                                                  '2012-01-06',
                                                  '2012-01-07',
                                                  '2012-01-08',
                                                  '2012-01-09',
                                                  '2012-01-10',
                                                  '2012-01-11',
                                                  '2012-01-12',
                                                  '2012-01-13']))

        self.assertEquals(cycle_time(history,
                                     include_states=['one', 'two', 'three']), 7)
コード例 #18
0
    def testGetCycleTimeIsStillOpen(self):

        history = pd.Series([START_STATE, 'pending'],
                            index=pd.to_datetime(['2012-01-01', '2012-01-02']))

        self.assertEquals(cycle_time(history), None)