Beispiel #1
0
def load_constants(worksheet):
    for loc in worksheet.iterkeys():
        formula = worksheet[loc].formula
        if formula:
            if not formula.startswith('='):
                worksheet[loc].value = eval_constant(formula)
                worksheet[loc].error = None
 def test_returns_float_for_floatlike_input(self):
     self.assertEquals(eval_constant('1'), 1)
     self.assertEquals(type(eval_constant('1')), type(1))
     self.assertEquals(eval_constant('1.5'), 1.5)
     self.assertEquals(eval_constant('1.5e10'), 1.5e10)
     self.assertEquals(type(eval_constant('1.5')), type(1.5))
 def test_returns_input_unchanged_in_general(self):
     input = 'input'
     self.assertEquals(id(eval_constant(input)), id(input))