def test_plot_bar_data_empty(self): fig, ax = plt.subplots() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'stdv') self.assertTrue(result is None) fig, ax = plt.subplots() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'sem') self.assertTrue(result is None)
def test_plot_bar_data_empty(self): fig, ax = plt.subplots() result = _plot_bar_data(ax, [], "red", 0.5, 3.75, 1.5, "stdv") self.assertTrue(result is None) fig, ax = plt.subplots() result = _plot_bar_data(ax, [], "red", 0.5, 3.75, 1.5, "sem") self.assertTrue(result is None)
def test_plot_bar_data_empty(self): """_plot_bar_data() should not error when given empty list of data, but should not plot anything.""" fig, ax = plt.subplots() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'stdv') self.assertTrue(result is None) fig, ax = plt.subplots() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'sem') self.assertTrue(result is None)
def test_plot_bar_data(self): fig, ax = plt.subplots() result = _plot_bar_data(ax, [1, 2, 3], 'red', 0.5, 3.75, 1.5, 'stdv') self.assertEqual(result[0].__class__.__name__, "Rectangle") self.assertEqual(len(result), 1) self.assertAlmostEqual(result[0].get_width(), 0.5) self.assertAlmostEqual(result[0].get_facecolor(), (1.0, 0.0, 0.0, 1.0)) self.assertAlmostEqual(result[0].get_height(), 2.0) fig, ax = plt.subplots() result = _plot_bar_data(ax, [1, 2, 3], 'red', 0.5, 3.75, 1.5, 'sem') self.assertEqual(result[0].__class__.__name__, "Rectangle") self.assertEqual(len(result), 1) self.assertAlmostEqual(result[0].get_width(), 0.5) self.assertAlmostEqual(result[0].get_facecolor(), (1.0, 0.0, 0.0, 1.0)) self.assertAlmostEqual(result[0].get_height(), 2.0)
def test_plot_bar_data_bad_error_bar_type(self): fig, ax = plt.subplots() with npt.assert_raises(ValueError): _plot_bar_data(ax, [1, 2, 3], 'red', 0.5, 3.75, 1.5, 'var')
def test_plot_bar_data_bad_error_bar_type(self): """_plot_bar_data() should raise an exception on bad error bar type.""" fig, ax = plt.subplots() with npt.assert_raises(ValueError): _plot_bar_data(ax, [1, 2, 3], 'red', 0.5, 3.75, 1.5, 'var')