def test_evaluate_formula(self): """Test for evaluating formula.""" formula = 'population * gender_ratio' variables = {'population': 100, 'gender_ratio': 0.45} self.assertEquals(45, evaluate_formula(formula, variables)) variables = {'population': None, 'gender_ratio': 0.45} self.assertIsNone(evaluate_formula(formula, variables))
def test_evaluate_formula(self): """Test for evaluating formula.""" formula = 'population * gender_ratio' variables = { 'population': 100, 'gender_ratio': 0.45 } self.assertEquals(45, evaluate_formula(formula, variables)) variables = { 'population': None, 'gender_ratio': 0.45 } self.assertIsNone(evaluate_formula(formula, variables))