##// END OF EJS Templates
update pylabtools tests
MinRK -
Show More
@@ -23,6 +23,7 b' from matplotlib import pyplot as plt'
23 import numpy as np
23 import numpy as np
24
24
25 # Our own imports
25 # Our own imports
26 from IPython.core.interactiveshell import InteractiveShell
26 from IPython.testing import decorators as dec
27 from IPython.testing import decorators as dec
27 from .. import pylabtools as pt
28 from .. import pylabtools as pt
28
29
@@ -62,10 +63,10 b' def test_import_pylab():'
62 nt.assert_true('plt' in ns)
63 nt.assert_true('plt' in ns)
63 nt.assert_equal(ns['np'], np)
64 nt.assert_equal(ns['np'], np)
64
65
65
66 class TestPylabSwitch(object):
66 class TestPylabSwitch(object):
67 class Shell(object):
67 class Shell(InteractiveShell):
68 pylab_gui_select = None
68 def enable_gui(self, gui):
69 pass
69
70
70 def setup(self):
71 def setup(self):
71 import matplotlib
72 import matplotlib
@@ -93,47 +94,47 b' class TestPylabSwitch(object):'
93
94
94 def test_qt(self):
95 def test_qt(self):
95 s = self.Shell()
96 s = self.Shell()
96 gui = pt.pylab_activate(dict(), None, False, s)
97 gui, backend = s.enable_matplotlib(None)
97 nt.assert_equal(gui, 'qt')
98 nt.assert_equal(gui, 'qt')
98 nt.assert_equal(s.pylab_gui_select, 'qt')
99 nt.assert_equal(s.pylab_gui_select, 'qt')
99
100
100 gui = pt.pylab_activate(dict(), 'inline', False, s)
101 gui, backend = s.enable_matplotlib('inline')
101 nt.assert_equal(gui, 'inline')
102 nt.assert_equal(gui, 'inline')
102 nt.assert_equal(s.pylab_gui_select, 'qt')
103 nt.assert_equal(s.pylab_gui_select, 'qt')
103
104
104 gui = pt.pylab_activate(dict(), 'qt', False, s)
105 gui, backend = s.enable_matplotlib('qt')
105 nt.assert_equal(gui, 'qt')
106 nt.assert_equal(gui, 'qt')
106 nt.assert_equal(s.pylab_gui_select, 'qt')
107 nt.assert_equal(s.pylab_gui_select, 'qt')
107
108
108 gui = pt.pylab_activate(dict(), 'inline', False, s)
109 gui, backend = s.enable_matplotlib('inline')
109 nt.assert_equal(gui, 'inline')
110 nt.assert_equal(gui, 'inline')
110 nt.assert_equal(s.pylab_gui_select, 'qt')
111 nt.assert_equal(s.pylab_gui_select, 'qt')
111
112
112 gui = pt.pylab_activate(dict(), None, False, s)
113 gui, backend = s.enable_matplotlib()
113 nt.assert_equal(gui, 'qt')
114 nt.assert_equal(gui, 'qt')
114 nt.assert_equal(s.pylab_gui_select, 'qt')
115 nt.assert_equal(s.pylab_gui_select, 'qt')
115
116
116 def test_inline(self):
117 def test_inline(self):
117 s = self.Shell()
118 s = self.Shell()
118 gui = pt.pylab_activate(dict(), 'inline', False, s)
119 gui, backend = s.enable_matplotlib('inline')
119 nt.assert_equal(gui, 'inline')
120 nt.assert_equal(gui, 'inline')
120 nt.assert_equal(s.pylab_gui_select, None)
121 nt.assert_equal(s.pylab_gui_select, None)
121
122
122 gui = pt.pylab_activate(dict(), 'inline', False, s)
123 gui, backend = s.enable_matplotlib('inline')
123 nt.assert_equal(gui, 'inline')
124 nt.assert_equal(gui, 'inline')
124 nt.assert_equal(s.pylab_gui_select, None)
125 nt.assert_equal(s.pylab_gui_select, None)
125
126
126 gui = pt.pylab_activate(dict(), 'qt', False, s)
127 gui, backend = s.enable_matplotlib('qt')
127 nt.assert_equal(gui, 'qt')
128 nt.assert_equal(gui, 'qt')
128 nt.assert_equal(s.pylab_gui_select, 'qt')
129 nt.assert_equal(s.pylab_gui_select, 'qt')
129
130
130 def test_qt_gtk(self):
131 def test_qt_gtk(self):
131 s = self.Shell()
132 s = self.Shell()
132 gui = pt.pylab_activate(dict(), 'qt', False, s)
133 gui, backend = s.enable_matplotlib('qt')
133 nt.assert_equal(gui, 'qt')
134 nt.assert_equal(gui, 'qt')
134 nt.assert_equal(s.pylab_gui_select, 'qt')
135 nt.assert_equal(s.pylab_gui_select, 'qt')
135
136
136 gui = pt.pylab_activate(dict(), 'gtk', False, s)
137 gui, backend = s.enable_matplotlib('gtk')
137 nt.assert_equal(gui, 'qt')
138 nt.assert_equal(gui, 'qt')
138 nt.assert_equal(s.pylab_gui_select, 'qt')
139 nt.assert_equal(s.pylab_gui_select, 'qt')
139
140
General Comments 0
You need to be logged in to leave comments. Login now