def test_save(self, mock_get_position_for_mode): mock_get_position_for_mode.return_value = 0 expected = 5 memory = [0] computer = IntComputer(memory=memory, inputs=[expected]) computer.save([]) assert computer.memory[0] == expected assert 2 == computer.pointer
def test_save_with_no_inputs(self, mock_get_position_for_mode, fake_input): expected = 5 fake_input.return_value = expected mock_get_position_for_mode.return_value = 0 memory = [0] computer = IntComputer(memory=memory) computer.save([]) assert computer.memory[0] == expected assert 2 == computer.pointer