예제 #1
0
    def test_mixed_parameters(self):
        ws = Worksheet()
        cell_range = ws.cell_range((10, 10),'C4')
        self.assertEquals(cell_range.left, 3)
        self.assertEquals(cell_range.top, 4)
        self.assertEquals(cell_range.right, 10)
        self.assertEquals(cell_range.bottom, 10)

        try:
            _ = ws.cell_range('wipple',(1,2))
            self.fail('should raise ValueError')
        except ValueError, e:
            self.assertEquals(str(e), "wipple is not a valid cell location")
예제 #2
0
    def test_single_string_parameter_uses_formula_notation(self):
        ws = Worksheet()
        cell_range = ws.cell_range('A2:C4')
        self.assertEquals(cell_range.left, 1)
        self.assertEquals(cell_range.top, 2)
        self.assertEquals(cell_range.right, 3)
        self.assertEquals(cell_range.bottom, 4)

        try:
            _ = ws.cell_range('A1:wibble')
            self.fail('should raise ValueError')
        except ValueError, e:
            self.assertEquals(str(e), "Invalid cell range 'A1:wibble'")
예제 #3
0
    def test_double_string_parameters_use_a1_notation(self):
        ws = Worksheet()
        cell_range = ws.cell_range('A2','C4')
        self.assertEquals(cell_range.left, 1)
        self.assertEquals(cell_range.top, 2)
        self.assertEquals(cell_range.right, 3)
        self.assertEquals(cell_range.bottom, 4)

        try:
            _ = ws.cell_range('wabble','C4')
            self.fail('should raise ValueError')
        except ValueError, e:
            self.assertEquals(str(e), "wabble is not a valid cell location")
예제 #4
0
 def test_two_tuple_parameters(self):
     ws = Worksheet()
     cell_range = ws.cell_range((2, 3), (5, 4))
     self.assertEquals(cell_range.left, 2)
     self.assertEquals(cell_range.top, 3)
     self.assertEquals(cell_range.right, 5)
     self.assertEquals(cell_range.bottom, 4)