コード例 #1
0
def simple_compare_without_order(s, args_mkv, args_mk):
    p = Parser()
    n = "_" + uuid.uuid4().hex
    exec p.parse(s, n)[1] in globals()

    for a, o in args_mkv:
        a, b = globals()[n]('test', 'test').make_key_value(a)
        if a is not None:
            a = sorted(a)
        if b is not None:
            b = sorted(b)
        assert (a, b) == o

    for a, o in args_mk:
        assert globals()[n]('test', 'test').make_key(a) == o
コード例 #2
0
def simple_compare(s, args_mkv, args_mk):
    p = Parser()
    n = "_" + uuid.uuid4().hex
    exec p.parse(s, n)[1] in globals()

    # n2 = p.parse(s)
    # exec n2 in globals()
    # n2 = n2.splitlines()[1][2:]

    for a, o in args_mkv:
        assert globals()[n]('test', 'test').make_key_value(a) == o
        # assert globals()[n2]('test','test').make_key_value(a) == o

    for a, o in args_mk:
        assert globals()[n]('test', 'test').make_key(a) == o