Skip to content

Commit 75c4923

Browse files
committed
Add a new exception class and test to ensure new expected error.
1 parent 2fa2cae commit 75c4923

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

plotly/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class PlotlyError(Exception):
2323
pass
2424

2525

26+
## Would Cause Server Errors ##
27+
28+
class PlotlyEmptyDataError(PlotlyError):
29+
pass
30+
31+
2632
## Graph Objects Errors ##
2733

2834
class PlotlyGraphObjectError(PlotlyError):

plotly/tests/test_core/test_plotly/test_plot.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
"""
88
from __future__ import absolute_import
99
from nose.tools import raises
10+
from unittest import TestCase
1011

1112
from plotly.graph_objs import graph_objs
1213
from plotly.plotly import plotly as py
13-
from plotly.exceptions import PlotlyError
14+
from plotly.exceptions import PlotlyError, PlotlyEmptyDataError
1415

1516

1617
# username for tests: 'PlotlyImageTest'
@@ -57,6 +58,14 @@ def test_plot_invalid_args_2():
5758
filename='plot_invalid')
5859

5960

61+
class TestPlot(TestCase):
62+
63+
def test_plot_empty_data(self):
64+
py.sign_in('PlotlyImageTest', '786r5mecv0')
65+
with self.assertRaises(PlotlyEmptyDataError):
66+
py.plot([], filename='plot_invalid')
67+
68+
6069
def test_bar():
6170
pass
6271

0 commit comments

Comments
 (0)