Beispiel #1
0
    def test_getitem_should_use_original_key_if_to_location_gives_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(3, 4))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4), ), {})])
        self.assertEquals(ws.keys(), [(3, 4)])
        self.assertEquals(ws.values()[0].formula, "hello")
    def test_getitem_should_use_original_key_if_to_location_gives_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(3, 4))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
        self.assertEquals(ws.keys(), [(3, 4)])
        self.assertEquals(ws.values()[0].formula, "hello")
Beispiel #3
0
    def test_getitem_should_use_to_location_result_if_it_is_not_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(1, 2))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4), ), {})])
        self.assertEquals(ws.keys(), [(1, 2)])
        self.assertEquals(ws.values()[0].formula, "hello")
    def test_getitem_should_use_to_location_result_if_it_is_not_none(self):
        ws = Worksheet()
        ws.to_location = Mock(return_value=(1, 2))

        ws[3, 4].formula = "hello"

        self.assertEquals(ws.to_location.call_args_list, [(((3, 4),), {})])
        self.assertEquals(ws.keys(), [(1, 2)])
        self.assertEquals(ws.values()[0].formula, "hello")