def test_setattr_should_not_delegate_to_setitem_if_attr_name_is_not_valid_cell_name(self):
        ws = Worksheet()
        ws.__setitem__ = Mock()

        ws.A1 = 23

        self.assertEquals( ws.__setitem__.call_args_list, [] )
        self.assertEquals( ws.A1, 23 )
Exemplo n.º 2
0
    def test_setattr_should_not_delegate_to_setitem_if_attr_name_is_not_valid_cell_name(
            self):
        ws = Worksheet()
        ws.__setitem__ = Mock()

        ws.A1 = 23

        self.assertEquals(ws.__setitem__.call_args_list, [])
        self.assertEquals(ws.A1, 23)
Exemplo n.º 3
0
    def test_setattr_should_delegate_to_setitem_if_attr_name_is_valid_cell_name(
            self, mock_name_to_coords):
        def name_to_coords(name):
            if name == 'A1':
                return (2, 3)
            else:
                return None

        mock_name_to_coords.side_effect = name_to_coords

        ws = Worksheet()
        ws.__setitem__ = Mock()

        ws.A1 = 23

        self.assertEquals(ws.__setitem__.call_args_list, [(((2, 3), 23), {})])
    def test_setattr_should_delegate_to_setitem_if_attr_name_is_valid_cell_name(
        self, mock_name_to_coords
    ):
        def name_to_coords(name):
            if name == 'A1':
                return (2, 3)
            else:
                return None
        mock_name_to_coords.side_effect = name_to_coords

        ws = Worksheet()
        ws.__setitem__ = Mock()

        ws.A1 = 23

        self.assertEquals( ws.__setitem__.call_args_list, [(((2, 3), 23), {})] )