def test_save_rollover_different(self):
        # Write some stuff to the state
        state['a'] = (-1) ** 2
        state['b'] = (-1) ** 3
        state['c'] = 41

        with tempfile.NamedTemporaryFile() as temp, \
                tempfile.NamedTemporaryFile() as temp2:
            # Save original state
            state.save(temp2.name, rotate_n_state_files=1)
            state.load(temp2.name)
            state['a'] = (-1) ** 2
            state.save(temp.name, rotate_n_state_files=1)

            for i in range(10):
                # Write bogus info to state
                state['a'] = i ** 2
                state['b'] = i ** 3
                state['c'] = 42 + i

                state.save(temp.name, rotate_n_state_files=1)

                # Load last file and check contents
                state.load(temp.name + ".1", lazy=True)
                self.assertEqual(state['a'], (i - 1) ** 2)
                self.assertEqual(state['b'], (i - 1) ** 3)
                self.assertEqual(state['c'], 42 + (i - 1))

                # Load current state and check contents
                state.load(temp.name, lazy=True)
                self.assertEqual(state['a'], i ** 2)
                self.assertEqual(state['b'], i ** 3)
                self.assertEqual(state['c'], 42 + i)

            # Remove temp files
            os.remove(temp.name + ".1")
            os.remove(temp2.name + ".1")
Returns the value of an expression on a document.
dataset/ETHPy150Open duerrp/pyexperiment/tests/test_state.py/TestStateIO.test_save_rollover_different--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/search/stub/expression_evaluator.py/ExpressionEvaluator.ValueOf