コード例 #1
0
def parse_references_check_good():
    good = [
        'v:analyzer/test/statistic',
        'v:analyzer/test/statistic@2016-12-01',
        'v:analyzer/log/statistic~master@2016-12-01',
        'v:analyzer/log/statistic~master',
    ]
    for g in good:
        parse_reference(g)
コード例 #2
0
ファイル: implementation.py プロジェクト: abdelq/duckietown
def _parse_regression_test_check(line):
    line = line.strip()
    tokens = line.split(' ')
    if len(tokens) != 3:
        msg = 'I expect exactly 3 tokens.\nLine: "%s"\nTokens: %s' % (line, tokens)
        raise DTConfigException(msg)
    
    try:
        ref1 = parse_reference(tokens[0])
        binary = parse_binary(tokens[1])
        ref2 = parse_reference(tokens[2])
        evaluable = BinaryEval(ref1, binary, ref2)
    except RTParseError as e:
        msg = 'Cannot parse string "%s".' % line
        raise_wrapped(RTParseError, e, msg, compact=True)
    return Wrapper(evaluable)
コード例 #3
0
def _parse_regression_test_check(line: str) -> Wrapper:
    line = line.strip()
    delim = " "
    tokens = line.split(delim)

    if len(tokens) != 3:
        msg = f'I expect exactly 3 tokens with delimiter {delim}.\nLine: "{line}"\nTokens: {tokens}'
        raise dtu.DTConfigException(msg)

    try:
        ref1 = parse_reference(tokens[0])
        binary = parse_binary(tokens[1])
        ref2 = parse_reference(tokens[2])
        evaluable = BinaryEval(ref1, binary, ref2)
    except RTParseError as e:
        msg = f'Cannot parse string "{line}".'
        dtu.raise_wrapped(RTParseError, e, msg, compact=True)
        raise
    return Wrapper(evaluable)
コード例 #4
0
ファイル: conditions.py プロジェクト: yuanjun5681/Software
def parse_condition_check_bad():
    bad = [
        'v:analyzer/test',
        'v:analyzer/test/statistic@2016-12-0a',
        'v:analyzer/test/statistic@',
        'v:analyzer/test/statistic~',
        'v:analyzer/test/statistic~@2016-12-01',
    ]
    for b in bad:
        try:
            res = parse_reference(b)
        except RTParseError:
            pass
        else:
            msg = 'Expected DTParseError.'
            msg += '\nString: %r' % b
            msg += '\nReturns: %s' % res
            raise Exception(msg)
コード例 #5
0
ファイル: conditions.py プロジェクト: light5551/dt-core
def parse_condition_check_bad():
    bad = [
        "v:analyzer/test",
        "v:analyzer/test/statistic@2016-12-0a",
        "v:analyzer/test/statistic@",
        "v:analyzer/test/statistic~",
        "v:analyzer/test/statistic~@2016-12-01",
    ]
    for b in bad:
        try:
            res = parse_reference(b)
        except RTParseError:
            pass
        else:
            msg = "Expected DTParseError."
            msg += f"\nString: {b!r}"
            msg += f"\nReturns: {res}"
            raise Exception(msg)
コード例 #6
0
def parse_one():
    s = 'v:analyzer/log/statistic?hash'
    a = parse_reference(s)
    assert a.commit == 'hash', a
    print a
コード例 #7
0
ファイル: references.py プロジェクト: light5551/dt-core
def parse_one():
    s = "v:analyzer/log/statistic?hash"
    a = parse_reference(s)
    assert a.commit == "hash", a
    print(a)