

def test_flatten():
    global FLATTEN
    FLATTEN = True
    NO(0, 'foo', 'bar')
    YES((), 'foo', 'foo')
    YES((), (), ())
    YES(('whatev',), ANY, 'whatev')
    YES((('whatev', 'whatev'),), ANY, ('whatev', 'whatev'))
    YES((), ('foo',), ('foo',))
    YES((('foo',),), ANY, ('foo',))
    YES(('foo',), (ANY,), ('foo',))
    YES((), (IGNORE(ANY),), ('whatev',))
    YES(('foo',), (ANY, IGNORE(ANY)), ('foo', 'whatev'))
    YES((), (IGNORE(ANY), IGNORE(ANY)), ('whatev', 'whatev'))
    YES(('foo', 'bar'), (ANY, ANY), ('foo', 'bar'))
    YES((), ('foo', IGNORE(ANY)), ('foo', 'whatev'))
    YES((), ('foo', (IGNORE(ANY),)), ('foo', ('whatev',)))
    YES((1, 2, 3), ('foo', (ANY, (ANY, (ANY,)))), ('foo', (1, (2, (3,)))))
    YES((2, 3), ('foo', (IGNORE(ANY), (ANY, (ANY,)))), ('foo', (1, (2, (3,)))))
    YES((3,), ('foo', (IGNORE(ANY), (IGNORE(ANY), (ANY,)))), ('foo', (1, (2, (3,)))))
    (ok, v1, v2) = match(('foo', ('bar', ANY, ('baz', ANY))), ('foo', ('bar', 123, ('baz', 456))), flatten=True)
    assert (v2 and ((v1, v2) == (123, 456)))

dataset/ETHPy150Open eallik/spinoff/spinoff/tests/test_pattern_matching.py test_flatten/VarMisuse@454/585 `ok`->`v2`