def test_chain(): cls = [Cls([Cls('a'), Cls('h')]), Cls([Cls('s'), Cls('u')])] assert cut(flatten(cut(cls).attr)).attr == list('ahsu') assert cut(cls).attr._.attr == list('ahsu') assert cut(cut(cls).attr) == cut(cls).attr assert cut(cut(cls).attr)._.attr == cut(cls).attr._.attr assert cut(cut(cls).attr._) == cut(cls).attr._ assert cut(cut(cls).attr._)._ellipsis_at_next == cut( cls).attr._._ellipsis_at_next assert cut(cut(cls).attr._).attr == cut(cls).attr._.attr assert cut(cut(cut(cls).attr)._).attr == cut(cls).attr._.attr
def test_flatten(): assert flatten([1, 2, 3]) == [1, 2, 3] assert flatten([[1], [2, 3]]) == [1, 2, 3] assert flatten([[[1, 2], [3]], [4, [5]]]) == [1, 2, 3, 4, 5] assert flatten([1]) == [1] assert flatten(['ab']) == ['ab']