From eef061e7e446a999337f990bcef1e793aa170c87 2014-04-19 18:45:02 From: Thomas Kluyver Date: 2014-04-19 18:45:02 Subject: [PATCH] Fix %bookmark -l for Python 3 Closes gh-5676 Also add a simple test for %bookmark --- diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py index 00a999a..ccb2105 100644 --- a/IPython/core/magics/osm.py +++ b/IPython/core/magics/osm.py @@ -663,8 +663,7 @@ class OSMagics(Magics): elif 'r' in opts: bkms = {} elif 'l' in opts: - bks = bkms.keys() - bks.sort() + bks = sorted(bkms) if bks: size = max(map(len, bks)) else: diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index f15c818..3e583ad 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -942,3 +942,10 @@ def test_edit_cell(): # test _run_edit_test("1", exp_contents=ip.user_ns['In'][1], exp_is_temp=True) + +def test_bookmark(): + ip = get_ipython() + ip.run_line_magic('bookmark', 'bmname') + with tt.AssertPrints('bmname'): + ip.run_line_magic('bookmark', '-l') + ip.run_line_magic('bookmark', '-d bmname')