def test_scope_property(self): assert "some random text" == P.Pipe( "some ", P.With( DummyContext("random "), ( P + P.Context, P.With( DummyContext("text"), P + P.Context ) ) ) ) with pytest.raises(Exception): P.Context() #Cannot use it outside of With
def test_context(self): y = P.Ref('y') length = P.Pipe( "phi/tests/test.txt", P.With( open, Context, Obj.read(), { y }, len ) ) assert length == 11 assert y() == "hello world"