def test_text(self): with self.assertRaises(calc.InvalidTokenError): calc.validate_token('a') with self.assertRaises(calc.InvalidTokenError): calc.validate_token('azerty')
def test_pars(self): calc.validate_token('(') calc.validate_token(')')
def test_operators(self): for op in "+-*/": calc.validate_token(op)
def test_numbers(self): calc.validate_token('0') calc.validate_token('5') calc.validate_token('5.5') calc.validate_token('00.000') calc.validate_token('10e2') calc.validate_token(' 45')
def test_none(self): with self.assertRaises(calc.InvalidTokenError): calc.validate_token(None)