def test_plot_box_data(self): """_plot_box_data() should return a dictionary for Line2D's.""" fig, ax = plt.subplots() result = _plot_box_data(ax, [0, 0, 7, 8, -3, 44], 'blue', 0.33, 55, 1.5, 'stdv') self.assertEqual(result.__class__.__name__, "dict") self.assertEqual(len(result['boxes']), 1) self.assertEqual(len(result['medians']), 1) self.assertEqual(len(result['whiskers']), 2) self.assertEqual(len(result['fliers']), 2) self.assertEqual(len(result['caps']), 2)
def test_plot_box_data(self): fig, ax = plt.subplots() result = _plot_box_data(ax, [0, 0, 7, 8, -3, 44], "blue", 0.33, 55, 1.5, "stdv") self.assertEqual(result.__class__.__name__, "dict") self.assertEqual(len(result["boxes"]), 1) self.assertEqual(len(result["medians"]), 1) self.assertEqual(len(result["whiskers"]), 2) # mpl < 1.4.0 creates two Line2D instances, mpl 1.4.0 creates one, # though the resulting plot looks identical between the two versions. # see: # https://github.com/pydata/pandas/issues/8382#issuecomment-56840974 # https://github.com/matplotlib/matplotlib/issues/3544 self.assertTrue(len(result["fliers"]) == 1 or len(result["fliers"]) == 2) self.assertEqual(len(result["caps"]), 2)
def test_plot_box_data(self): fig, ax = plt.subplots() result = _plot_box_data(ax, [0, 0, 7, 8, -3, 44], 'blue', 0.33, 55, 1.5, 'stdv') self.assertEqual(result.__class__.__name__, "dict") self.assertEqual(len(result['boxes']), 1) self.assertEqual(len(result['medians']), 1) self.assertEqual(len(result['whiskers']), 2) # mpl < 1.4.0 creates two Line2D instances, mpl 1.4.0 creates one, # though the resulting plot looks identical between the two versions. # see: # https://github.com/pydata/pandas/issues/8382#issuecomment-56840974 # https://github.com/matplotlib/matplotlib/issues/3544 self.assertTrue( len(result['fliers']) == 1 or len(result['fliers']) == 2) self.assertEqual(len(result['caps']), 2)
def test_plot_box_data_empty(self): fig, ax = plt.subplots() result = _plot_box_data(ax, [], 'blue', 0.33, 55, 1.5, 'stdv') self.assertTrue(result is None)
def test_plot_box_data_empty(self): """Should ignore empty distribution.""" fig, ax = plt.subplots() result = _plot_box_data(ax, [], 'blue', 0.33, 55, 1.5, 'stdv') self.assertTrue(result is None)