Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d69887d

Browse files
committed
basic usage tests
1 parent 96bb809 commit d69887d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
test__offline
3+
4+
"""
5+
from __future__ import absolute_import
6+
from nose.tools import raises
7+
import os
8+
9+
10+
from plotly.exceptions import PlotlyError
11+
import plotly
12+
13+
14+
@raises(PlotlyError)
15+
def test_calling_iplot_before_initializing_raises_an_error():
16+
plotly.offline.iplot([{'x': [1, 2, 3]}])
17+
18+
19+
def test_no_errors_are_raised_when_properly_initializing_offline_mode():
20+
plotly.offline.init_notebook_mode()
21+
plotly.offline.iplot([{'x': [1, 2, 3]}])
22+
23+
24+
def test_downloading_file_saves_it_to_the_disk():
25+
dummy_js_url = ('https://gist.githubusercontent.com/chriddyp/'
26+
'f40bd33d1eab6f0715dc/raw/'
27+
'24cd2e4e62ceea79e6e790b3a2c94cda63510ede/test.js')
28+
29+
plotly.offline.download_plotlyjs(dummy_js_url)
30+
assert os.path.isfile(plotly.offline.PLOTLY_OFFLINE_BUNDLE) is True

0 commit comments

Comments
 (0)