|
17 | 17 |
|
18 | 18 | from plotly import exceptions
|
19 | 19 | from plotly.plotly import plotly as py
|
20 |
| - |
21 |
| -py.sign_in('test-runner', '9h29fe3l0x') |
22 |
| - |
23 |
| -@raises(exceptions.PlotlyError) |
24 |
| -def test_update_type_error(): |
25 |
| - fig, ax = plt.subplots() |
26 |
| - ax.plot([1, 2, 3]) |
27 |
| - update = [] |
28 |
| - py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) |
29 |
| - |
30 |
| - |
31 |
| -@raises(exceptions.PlotlyError) |
32 |
| -def test_update_validation_error(): |
33 |
| - fig, ax = plt.subplots() |
34 |
| - ax.plot([1, 2, 3]) |
35 |
| - update = {'invalid': 'anything'} |
36 |
| - py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) |
37 |
| - |
38 |
| - |
39 |
| -@attr('slow') |
40 |
| -def test_update(): |
41 |
| - fig, ax = plt.subplots() |
42 |
| - ax.plot([1, 2, 3]) |
43 |
| - title = 'new title' |
44 |
| - update = {'layout': {'title': title}} |
45 |
| - url = py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) |
46 |
| - un = url.replace("https://plot.ly/~", "").split('/')[0] |
47 |
| - fid = url.replace("https://plot.ly/~", "").split('/')[1] |
48 |
| - pfig = py.get_figure(un, fid) |
49 |
| - assert pfig['layout']['title'] == title |
| 20 | +from plotly.tests.utils import PlotlyTestCase |
| 21 | + |
| 22 | + |
| 23 | +class PlotMPLTest(PlotlyTestCase): |
| 24 | + @raises(exceptions.PlotlyError) |
| 25 | + def test_update_type_error(self): |
| 26 | + fig, ax = plt.subplots() |
| 27 | + ax.plot([1, 2, 3]) |
| 28 | + update = [] |
| 29 | + py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) |
| 30 | + |
| 31 | + @raises(exceptions.PlotlyError) |
| 32 | + def test_update_validation_error(self): |
| 33 | + fig, ax = plt.subplots() |
| 34 | + ax.plot([1, 2, 3]) |
| 35 | + update = {'invalid': 'anything'} |
| 36 | + py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) |
| 37 | + |
| 38 | + @attr('slow') |
| 39 | + def test_update(self): |
| 40 | + fig, ax = plt.subplots() |
| 41 | + ax.plot([1, 2, 3]) |
| 42 | + title = 'new title' |
| 43 | + update = {'layout': {'title': title}} |
| 44 | + url = py.plot_mpl(fig, update=update, filename="nosetests", |
| 45 | + auto_open=False) |
| 46 | + un = url.replace("https://plot.ly/~", "").split('/')[0] |
| 47 | + fid = url.replace("https://plot.ly/~", "").split('/')[1] |
| 48 | + pfig = py.get_figure(un, fid) |
| 49 | + assert pfig['layout']['title'] == title |
0 commit comments