def testExponents(self): signs = ("", "+", "-") mantissas = ("1", "1.", ".1", "12", "12.", "1.2", ".12", "123", "123.", "12.3", "1.23", ".123") es = "eE" exps = ("1", "12", "+1", "-1", "+12", "-12") for parts in itertools.product(signs, mantissas, es, exps): expstring = "".join(parts) self.assertTrue(exponent_syntax.match(expstring))
def testInvalidExponents(self): # Add test cases as needed invalid = (".e1", ) for expstring in invalid: self.assertFalse(exponent_syntax.match(expstring))