示例#1
0
文件: tests.py 项目: xusiwei/mbed-os
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
示例#2
0
文件: tests.py 项目: xusiwei/mbed-os
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)
                ])))
示例#3
0
文件: tests.py 项目: SoCM/ELEC143
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
示例#4
0
文件: tests.py 项目: SoCM/ELEC143
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)])))