From d4b7d3d536ecb16e1704cb7f73acf0f667d17dc6 2010-10-13 06:52:58 From: Fernando Perez Date: 2010-10-13 06:52:58 Subject: [PATCH] Fix small bug where %xmode without arguments failed to run. Added unit test. --- diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 3ddd9bb..02af20e 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -355,3 +355,10 @@ def test_cpaste(): for code in tests['fail']: check_cpaste(code, should_fail=True) + +def test_xmode(): + # Calling xmode three times should be a no-op + xmode = _ip.InteractiveTB.mode + for i in range(3): + _ip.magic("xmode") + nt.assert_equal(_ip.InteractiveTB.mode, xmode) diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index b40aaa5..85200a1 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -1090,7 +1090,7 @@ class FormattedTB(VerboseTB, ListTB): # include variable details only in 'Verbose' mode self.include_vars = (self.mode == self.valid_modes[2]) # Set the join character for generating text tracebacks - self.tb_join_char = self._join_chars[mode] + self.tb_join_char = self._join_chars[self.mode] # some convenient shorcuts def plain(self):