示例#1
0
    def test_clone_is_separate_instance(self):
        state = State(current_number=3, steps=[2, 4, 8])
        cloned_state = state.clone()

        op1 = Mock()
        op1.operate.side_effect = add_four
        state.apply(op1)

        self.assertEqual(cloned_state.current_number, 3)
        self.assertEqual(cloned_state.steps, [2, 4, 8])
示例#2
0
    def test_clone_values(self):
        state = State(current_number=3, steps=[2, 4, 8])
        cloned_state = state.clone()

        self.assertEqual(cloned_state.current_number, 3)
        self.assertEqual(cloned_state.steps, [2, 4, 8])