def test_with_block_show(self):
        with tempfile.NamedTemporaryFile() as temp:
            state.reset_instance()
            state['a'] = 12
            with StateHandler(temp.name, load=True):
                self.assertEqual(len(state), 1)
                self.assertEqual(state['a'], 12)

                buf = io.StringIO()
                with stdout_redirector(buf):
                    state.show()
                self.assertNotEqual(len(buf.getvalue()), 0)
                self.assertRegexpMatches(buf.getvalue(), r"a:12")
Test with-block of the StateHandler does not cause show to fail
dataset/ETHPy150Open duerrp/pyexperiment/tests/test_state.py/TestStateHandler.test_with_block_show