Skip to content

Commit 0f2d92a

Browse files
committed
move distplot tests
- all distplot tests are depending on scipy
1 parent 4f442e2 commit 0f2d92a

File tree

2 files changed

+30
-34
lines changed

2 files changed

+30
-34
lines changed

plotly/tests/test_core/test_tools/test_figure_factory.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -802,37 +802,3 @@ 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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,36 @@
1111

1212
class TestDistplot(TestCase):
1313

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

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

0 commit comments

Comments
 (0)