def __init__(self, path): source_extension = re.escape(SOURCE_EXTENSION) path = to_posix_path(path.strip()) path_to, filename = posixpath.split(path) path_to = '.' if not path_to else path_to name = re.search(r'(.+)%s$' % source_extension, filename).group(1) answer_filename = name + ANSWER_EXTENSION output_filename = name + OUTPUT_EXTENSION self.source = TestComponent(path, path_to, name, filename) self.answer = TestComponent(posixpath.join(path_to, answer_filename), path_to, name, answer_filename) self.output = TestComponent(posixpath.join(path_to, output_filename), path_to, name, output_filename)
def __init__(self, path): source_extension = re.escape(SOURCE_EXTENSION) path = re.sub(r'^\.{1,2}[/\\]', '', to_posix_path(path.strip())) path_to, filename = posixpath.split(path) name = os.path.splitext(filename)[0] answer_filename = name + ANSWER_EXTENSION output_filename = name + OUTPUT_EXTENSION self.source = TestComponent(path, path_to, name, filename) self.answer = TestComponent( posixpath.join(path_to, answer_filename), path_to, name, answer_filename ) self.output = TestComponent( posixpath.join(path_to, output_filename), path_to, name, output_filename )
def __init__(self, path): source_extension = re.escape(SOURCE_EXTENSION) path = to_posix_path(path.strip()) path_to, filename = posixpath.split(path) path_to = '.' if not path_to else path_to name = re.search(r'(.+)%s$' % source_extension, filename).group(1) answer_filename = name + ANSWER_EXTENSION output_filename = name + OUTPUT_EXTENSION self.source = TestComponent(path, path_to, name, filename) self.answer = TestComponent( posixpath.join(path_to, answer_filename), path_to, name, answer_filename ) self.output = TestComponent( posixpath.join(path_to, output_filename), path_to, name, output_filename )