def test_notation_regexp():
 pattern = re.compile(SCIENTIFIC_NOTATION_REGEXP)
 matches = ['1e3', '1.E4', '-1e-3', '2.3e+4', '.2e4']
 fails = ['string', '4', '2.1', '1.2e3.2', '.e4', 'a3e4']
 for match in matches:
  assert pattern.match(match)
 for fail in fails:
  assert (not pattern.match(fail))

def test_notation_regexp ( ) : pattern = re . compile ( SCIENTIFIC_NOTATION_REGEXP ) matches = [ '1e3' , '1.E4' , '-1e-3' , '2.3e+4' , '.2e4' ] fails = [ 'string' , '4' , '2.1' , '1.2e3.2' , '.e4' , 'a3e4' ] for match in matches : assert pattern . match ( match ) for fail in fails : assert ( not pattern . match ( fail ) )
tests for regular expression aiming to filter scientific notations which are not correctly parsed as floats by yaml .