def test_redirectors(): n = Node('a','b') n.children = [Node('x','y')] list(n) to = To(n) to.stdout('hello there') n1 = to() assert n1 == n to.head.data('c') assert n.head.data == 'c' to.head.code('e') assert n.head.code == 'e' to.head.view('m') assert n.head.view == 'm' to.body.code('f') assert n.body.code == 'f' to.body.data('d') assert n.body.data == 'd' to.body.view('h') assert n.body.view == 'h' nc = n.children[0] assert nc.parent == n to = To(nc) to.parent.body.data('ko') assert n.body.data == 'ko'
@register(pipe_3, 1, 0) def test_pipe_3(): n = pipe_3 standard(n) n.render() assert n.body.data == 'OK' pipe_4 = Node( "@pipe node.children | sorted | to.children", "") pipe_4.children = [Node('a','c', level='3.1'), Node('b','d', level='1.1')] @register(pipe_4, 1, 0) def test_pipe_4(): n = pipe_4 standard(n) a = n.children[0].head.text assert a == 'a' n.render() b = n.children[0].head.text assert b == 'b' assert a != b pipe_5 = node1( "@pipe node.body.data | upper | to.head.data", "this is a body"