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 = _create_plot() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'stdv') self.assertTrue(result is None) fig, ax = _create_plot() result = _plot_bar_data(ax, [], 'red', 0.5, 3.75, 1.5, 'sem') self.assertTrue(result is None)
def test_plot_bar_data(self): """_plot_bar_data() should return a list of Rectangle objects.""" fig, ax = _create_plot() 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.assertFloatEqual(result[0].get_width(), 0.5) self.assertFloatEqual(result[0].get_facecolor(), (1.0, 0.0, 0.0, 1.0)) self.assertFloatEqual(result[0].get_height(), 2.0) fig, ax = _create_plot() 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.assertFloatEqual(result[0].get_width(), 0.5) self.assertFloatEqual(result[0].get_facecolor(), (1.0, 0.0, 0.0, 1.0)) self.assertFloatEqual(result[0].get_height(), 2.0)