Beispiel #1
0
    def test_stage_state_assignment(self, mocked_init, t, l, i, b):

        s = Stage()
        s._uid = 'test_stage'

        data_type = [l, i, b]

        for data in data_type:
            with self.assertRaises(TypeError):
                s.state = data

        if isinstance(t, str):
            with self.assertRaises(ValueError):
                s.state = t

        s = Stage()
        s._uid = 'test_stage'
        s._state = None
        s._state_history = list()
        state_history = list()
        states_list = list(states._stage_state_values.keys())
        shuffle(states_list)
        for val in states_list:
            s.state = val
            if val != states.SUSPENDED:
                state_history.append(val)
            self.assertEqual(s._state, val)
            self.assertEqual(s._state_history, state_history)
def test_stage_state_assignment(t, l, i, b):

    s = Stage()

    data_type = [l, i, b]

    for data in data_type:
        with pytest.raises(TypeError):
            s.state = data

    if isinstance(t, str):
        with pytest.raises(ValueError):
            s.state = t

    for val in states._stage_state_values.keys():
        s.state = val
Beispiel #3
0
def test_stage_state_assignment(t, l, i, b):

    s = Stage()

    data_type = [l, i, b]

    for data in data_type:
        with pytest.raises(TypeError):
            s.state = data

    if isinstance(t, str):
        with pytest.raises(ValueError):
            s.state = t

    for val in list(states._stage_state_values.keys()):
        s.state = val