def test_load_constants_should_clear_errors_for_constants(self):
        cell = Cell()
        cell.formula = "a constant"
        cell.error = 'Ohno!'
        worksheet = Worksheet()
        worksheet.A1 = cell

        load_constants(worksheet)

        self.assertIsNone(cell.error)
Example #2
0
    def test_load_constants_should_clear_errors_for_constants(self):
        cell = Cell()
        cell.formula = "a constant"
        cell.error = 'Ohno!'
        worksheet = Worksheet()
        worksheet.A1 = cell

        load_constants(worksheet)

        self.assertIsNone(cell.error)
    def test_load_constants_should_call_eval_constant_only_on_every_constant_location(self, mock_eval_constant):
        worksheet = Worksheet()
        worksheet[11,1].formula = "=formula1"
        worksheet[22,2].formula = "constant"
        worksheet[33,3].formula = "=formula2"
        worksheet[44,4].formula = "another constant"

        load_constants(worksheet)
        expected = [
            (("constant",), {}),
            (("another constant",), {}),
        ]
        self.assertItemsEqual(mock_eval_constant.call_args_list, expected)
Example #4
0
    def test_load_constants_should_call_eval_constant_only_on_every_constant_location(
            self, mock_eval_constant):
        worksheet = Worksheet()
        worksheet[11, 1].formula = "=formula1"
        worksheet[22, 2].formula = "constant"
        worksheet[33, 3].formula = "=formula2"
        worksheet[44, 4].formula = "another constant"

        load_constants(worksheet)
        expected = [
            (("constant", ), {}),
            (("another constant", ), {}),
        ]
        self.assertItemsEqual(mock_eval_constant.call_args_list, expected)