Skip to content

Commit 4f442e2

Browse files
committed
move non-scipy dependent checks to test_core
1 parent e42634b commit 4f442e2

File tree

2 files changed

+34
-33
lines changed

2 files changed

+34
-33
lines changed

plotly/tests/test_core/test_tools/test_figure_factory.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,3 +802,37 @@ def test_datetime_candlestick(self):
802802

803803
self.assertEqual(candle, exp_candle)
804804

805+
806+
class TestDistplot(TestCase):
807+
808+
def test_wrong_curve_type(self):
809+
810+
# check: PlotlyError (and specific message) is raised if curve_type is
811+
# not 'kde' or 'normal'
812+
813+
kwargs = {'hist_data': [[1, 2, 3]], 'group_labels': ['group'],
814+
'curve_type': 'curve'}
815+
self.assertRaisesRegexp(PlotlyError, "curve_type must be defined as "
816+
"'kde' or 'normal'",
817+
tls.FigureFactory.create_distplot, **kwargs)
818+
819+
def test_wrong_histdata_format(self):
820+
821+
# check: PlotlyError if hist_data is not a list of lists or list of
822+
# np.ndarrays (if hist_data is entered as just a list the function
823+
# will fail)
824+
825+
kwargs = {'hist_data': [1, 2, 3], 'group_labels': ['group']}
826+
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
827+
**kwargs)
828+
829+
def test_unequal_data_label_length(self):
830+
kwargs = {'hist_data': [[1, 2]], 'group_labels': ['group', 'group2']}
831+
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
832+
**kwargs)
833+
834+
kwargs = {'hist_data': [[1, 2], [1, 2, 3]], 'group_labels': ['group']}
835+
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
836+
**kwargs)
837+
838+

plotly/tests/test_optional/test_opt_tracefactory.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,9 @@
88

99
import numpy as np
1010

11-
import scipy
12-
import scipy.stats
13-
1411

1512
class TestDistplot(TestCase):
1613

17-
def test_wrong_curve_type(self):
18-
19-
# check: PlotlyError (and specific message) is raised if curve_type is
20-
# not 'kde' or 'normal'
21-
22-
kwargs = {'hist_data': [[1, 2, 3]], 'group_labels': ['group'],
23-
'curve_type': 'curve'}
24-
self.assertRaisesRegexp(PlotlyError, "curve_type must be defined as "
25-
"'kde' or 'normal'",
26-
tls.FigureFactory.create_distplot, **kwargs)
27-
28-
def test_wrong_histdata_format(self):
29-
30-
# check: PlotlyError if hist_data is not a list of lists or list of
31-
# np.ndarrays (if hist_data is entered as just a list the function
32-
# will fail)
33-
34-
kwargs = {'hist_data': [1, 2, 3], 'group_labels': ['group']}
35-
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
36-
**kwargs)
37-
38-
def test_unequal_data_label_length(self):
39-
kwargs = {'hist_data': [[1, 2]], 'group_labels': ['group', 'group2']}
40-
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
41-
**kwargs)
42-
43-
kwargs = {'hist_data': [[1, 2], [1, 2, 3]], 'group_labels': ['group']}
44-
self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot,
45-
**kwargs)
46-
4714
def test_simple_distplot(self):
4815

4916
# we should be able to create a single distplot with a simple dataset

0 commit comments

Comments
 (0)