Esempio n. 1
0
def check_errors(string, messages):
    errors = Errors()
    try:
        list(_tokenize(string, errors))
    except TokenizerError:
        errors_set = {(e.message, e.location.start.offset,
                       e.location.end.offset)
                      for e in errors.list}
        for error in messages:
            assert error in errors_set
    else:
        raise AssertionError('No errors')
Esempio n. 2
0
def check_errors(string, messages):
    errors = Errors()
    try:
        list(_tokenize(string, errors))
    except TokenizerError:
        errors_set = {
            (e.message, e.location.start.offset, e.location.end.offset)
            for e in errors.list
        }
        for error in messages:
            assert error in errors_set
    else:
        raise AssertionError('No errors')
Esempio n. 3
0
def tokenize(src, errors=None):
    src = dedent(src).strip()
    return _tokenize(src, errors)
Esempio n. 4
0
def tokenize(src, errors=None):
    src = dedent(src).strip()
    return _tokenize(src, errors)