Exemple #1
0
def test_name_known(string):
    if string not in TEST_MAP.keys() and \
       (getattr(ps, "test_alias", None) is None or \
        ps.test_alias.get(string, "") not in TEST_MAP.keys()):
        raise ArgumentTypeError(
            "Program with name '{0}' not found. Supported tests are: \n{1}".
            format(string, columnate([t['id'] for t in TESTS])))

    return TEST_MAP[string].n
Exemple #2
0
def test_known(string):
    i = int(string)
    if i >= 0 and i < len(TESTS):
        return i
    else:
        raise ArgumentTypeError(
            "{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}"
            .format(
                i,
                len(TEST_MAP) - 1,
                columnate([
                    str(i) + ":" + t['id']
                    for i, t in zip(range(len(TESTS)), TESTS)
                ])))
Exemple #3
0
def test_name_known(string):
    if string not in TEST_MAP.keys() and \
       (getattr(ps, "test_alias", None) is None or \
        ps.test_alias.get(string, "") not in TEST_MAP.keys()):
        raise ArgumentTypeError("Program with name '{0}' not found. Supported tests are: \n{1}".format(string, columnate([t['id'] for t in TESTS])))

    return TEST_MAP[string].n
Exemple #4
0
def test_known(string):
    i = int(string)
    if i >= 0 and i < len(TESTS):
        return i
    else:
        raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)])))