def get_tests_info(input_dir, msg_dir, prefix, suffix):
 result = []
 for fname in glob(join(input_dir, ((prefix + '*') + suffix))):
  infile = basename(fname)
  fbase = splitext(infile)[0]
  pyrestr = fbase.rsplit('_py', 1)[(-1)]
  if pyrestr.isdigit():
   if (SYS_VERS_STR < pyrestr):
    continue
  if (pyrestr.startswith('_') and pyrestr[1:].isdigit()):
   if (SYS_VERS_STR >= pyrestr[1:]):
    continue
  messages = glob(join(msg_dir, (fbase + '*.txt')))
  if messages:
   for outfile in sorted(messages, reverse=True):
    py_rest = outfile.rsplit('_py', 1)[(-1)][:(-4)]
    if (py_rest.isdigit() and (SYS_VERS_STR >= py_rest)):
     break
  else:
   outfile = join(msg_dir, (fbase + '.txt'))
  result.append((infile, outfile))
 return result

def get_tests_info ( input_dir , msg_dir , prefix , suffix ) : result = [ ] for fname in glob ( join ( input_dir , ( ( prefix + '*' ) + suffix ) ) ) : infile = basename ( fname ) fbase = splitext ( infile ) [ 0 ] pyrestr = fbase . rsplit ( '_py' , 1 ) [ ( - 1 ) ] if pyrestr . isdigit ( ) : if ( SYS_VERS_STR < pyrestr ) : continue if ( pyrestr . startswith ( '_' ) and pyrestr [ 1 : ] . isdigit ( ) ) : if ( SYS_VERS_STR >= pyrestr [ 1 : ] ) : continue messages = glob ( join ( msg_dir , ( fbase + '*.txt' ) ) ) if messages : for outfile in sorted ( messages , reverse = True ) : py_rest = outfile . rsplit ( '_py' , 1 ) [ ( - 1 ) ] [ : ( - 4 ) ] if ( py_rest . isdigit ( ) and ( SYS_VERS_STR >= py_rest ) ) : break else : outfile = join ( msg_dir , ( fbase + '.txt' ) ) result . append ( ( infile , outfile ) ) return result
get python input examples and output messages we use following conventions for input files and messages: for different inputs: test for python >= x .