def check(source, sourcefile, no_errors=False): # Strip trailing spaces, since the most comfortable triple-quoted # string format will have extra spaces on the last line. If this isn't # removed, it'll throw off the trailing newline checker. source = source.rstrip(' ') source, error_locations = find_error_locations(source) if no_errors: error_locations = [] sourcefile.write_text(source, encoding='utf-8') lint = EbbLint(ast.parse(source), sourcefile.strpath) actual = [ (line, col, message[:4]) for line, col, message, _ in lint.run()] assert actual == error_locations
def assert_ebb_lint(source_text, source_path, error_locations): lint = EbbLint(ast.parse(source_text), source_path) return [(line, col, message[:4]) for line, col, message, _ in lint.run()]
def assert_ebb_lint(source_text, source_path, error_locations): lint = EbbLint(ast.parse(source_text), source_path) actual = { (line, col, message[:4]) for line, col, message, _ in lint.run()} assert actual == set(error_locations)