Пример #1
0
 def test_create_chart_w_multiple_ranges(self):
     ranges = [
         pyoo.SheetAddress(0, 0, 2, 3),
         pyoo.SheetAddress(10, 10, 2, 3)
     ]
     with self.create_chart(ranges=ranges) as chart:
         self.assertEqual(['$A$1:$C$2', '$K$11:$M$12'],
                          list(map(str, chart.ranges)))
Пример #2
0
 def create_chart(self, name=None, position=None, ranges=None, **kwargs):
     self.__class__._chart_index += 1
     name = name or 'Chart %d' % self.__class__._chart_index
     position = position or pyoo.SheetPosition(0, 0, 1000, 1000)
     ranges = ranges or pyoo.SheetAddress(0, 0, 2, 3)
     yield self.sheet.charts.create(name, position, ranges, **kwargs)
     del self.sheet.charts[name]
Пример #3
0
 def test_range_text(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$B$1:$D$2', pyoo.text_type(address))
     self.assertIsInstance(pyoo.text_type(address), pyoo.text_type)
Пример #4
0
 def test_ranges_str(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual(b'$B$1:$D$2', str(address))
     self.assertIsInstance(str(address), str)
Пример #5
0
 def test_cell_text(self):
     address = pyoo.SheetAddress(0, 1)
     self.assertEqual(u'$B$1', pyoo.text_type(address))
     self.assertIsInstance(pyoo.text_type(address), pyoo.text_type)
Пример #6
0
 def test_cell_str(self):
     address = pyoo.SheetAddress(0, 1)
     self.assertEqual(b'$B$1', str(address))
     self.assertIsInstance(str(address), str)
Пример #7
0
 def test_replace_col_count(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$B$1:$B$2', str(address.replace(col_count=1)))
Пример #8
0
 def test_replace_row(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$B$2:$D$3', str(address.replace(row=1)))
Пример #9
0
 def test_replace_col(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$C$1:$E$2', str(address.replace(col=2)))
Пример #10
0
 def test_range_formula_row_and_col_abs(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$B$1:$D$2',
                      address.formula(row_abs=True, col_abs=True))
Пример #11
0
 def test_range_formula_col_abs(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('$B1:$D2', address.formula(col_abs=True))
Пример #12
0
 def test_range_formula(self):
     address = pyoo.SheetAddress(0, 1, 2, 3)
     self.assertEqual('B1:D2', address.formula())
Пример #13
0
 def test_cell_formula_row_and_col_abs(self):
     address = pyoo.SheetAddress(0, 1)
     self.assertEqual('$B$1', address.formula(row_abs=True, col_abs=True))
Пример #14
0
 def test_cell_formula(self):
     address = pyoo.SheetAddress(0, 1)
     self.assertEqual('B1', address.formula())