def test_ctor(self): from openpyxl.chart import Axis, Legend from openpyxl.drawing import Drawing c = Chart(None, None) eq_(c.type, None) eq_(c.grouping, None) assert_true(isinstance(c.x_axis, Axis)) assert_true(isinstance(c.y_axis, Axis)) assert_true(isinstance(c.legend, Legend)) eq_(c.show_legend, True) eq_(c.lang, 'fr-FR') eq_(c.title, '') eq_(c.print_margins, { 'b': .75, 'l': .7, 'r': .7, 't': .75, 'header': 0.3, 'footer': .3 }) assert_true(isinstance(c.drawing, Drawing)) eq_(c.width, .6) eq_(c.height, .6) eq_(c.margin_top, c._get_max_margin_top()) eq_(c.margin_left, 0) eq_(c._shapes, [])
def test_computer_xmin_xmax(self): c = Chart(None, None) s = Serie(self.range, xvalues=self.range) c._series.append(s) c._compute_xmin_xmax() eq_(c.x_axis.max, 2.0) eq_(c.x_axis.unit, 1.0)
def test_get_min_margin_left(self): c = Chart(None, None) c._series.append(self.range) eq_(c._get_min_margin_left(), 1.2857142857142858)
def test_get_max_margin_top(self): c = Chart(None, None) eq_(c._get_max_margin_top(), 0.21250000000000005)
def test_compute_min_max(self): c = Chart(None, None) c._series.append(self.range) c._compute_min_max() eq_(c.y_axis.max, 2.0) eq_(c.y_axis.unit, 1.0)
def test_get_y_char(self): c = Chart(None, None) c._series.append(self.range) eq_(c.get_y_chars(), 1)
def test_get_y_unit(self): c = Chart(None, None) c._series.append(self.range) c.y_axis.max = 10 eq_(c.get_y_units(), 109728.0)
def test_get_x_unit(self): c = Chart(None, None) c._series.append(self.range) eq_(c.get_x_units(), 10)
def test_mymax(self): c = Chart(None, None) eq_(c.mymax(range(10)), 9) from string import letters eq_(c.mymax(list(letters)), "z")