

def YES(out, pattern, data):
    x = match(pattern, data, flatten=FLATTEN)
    if (not FLATTEN):
        assert x[0], 'should have matched'
        assert (type(x[1]) is tuple)
        assert (x[1] == out), ('should have returned %s but returned %s' % (repr(out), repr(x[1])))
    else:
        assert ((x is True) if (out == ()) else x[0]), 'should have matched'
        assert ((out == ()) or (x[1:] == out)), ('should have returned %s but returned %s' % (repr(out), repr(x[1:])))

dataset/ETHPy150Open eallik/spinoff/spinoff/tests/test_pattern_matching.py YES/original