def test_long_1(): p = Pipeline() p.add("foo") assert (p.read(2) == "fo") p.add("bar") assert (p.read(3) == "oba") p.backup("rocko") p.add(StringIO("soma")) assert (p.read(1000) == "rockorsoma") assert (p.read(1000) == "") assert (p.empty) p.add("X" * 10000) p.close_request() assert (p.read(5000) == 'X' * 5000) p.backup('XXX') try: p.add("newstuff") except PipelineClosed: pass assert (not p.empty) assert (p.read(100000) == 'X' * 5003) assert (not p.empty) try: p.read(1000) except PipelineCloseRequest: pass assert (not p.empty) try: p.read(1000) except PipelineCloseRequest: pass
def test_close(): p = Pipeline() p.add("foo") p.add(StringIO("bar")) p.close_request() WVPASS(p.read(1000) == "foobar") WVEXCEPT(PipelineCloseRequest, p.read, 1000)
def test_close(self): p = Pipeline() p.add("foo") p.add(StringIO("bar")) p.close_request() assert p.read(1000) == "foobar" py.test.raises(PipelineCloseRequest, p.read, 1000)
def test_close(): p = Pipeline() p.add("foo") p.add(StringIO("bar")) p.close_request() assert (p.read(1000) == "foobar") try: p.read(1000) except PipelineCloseRequest: pass
def test_long_1(): p = Pipeline() p.add("foo") WVPASS(p.read(2) == "fo") p.add("bar") WVPASS(p.read(3) == "oba") p.backup("rocko") p.add(StringIO("soma")) WVPASS(p.read(1000) == "rockorsoma") WVPASS(p.read(1000) == "") WVPASS(p.empty) p.add("X" * 10000) p.close_request() WVPASS(p.read(5000) == 'X' * 5000) p.backup('XXX') WVEXCEPT(PipelineClosed, p.add, "newstuff") WVPASS(not p.empty) WVPASS(p.read(100000) == 'X' * 5003) WVPASS(not p.empty) WVEXCEPT(PipelineCloseRequest, p.read, 1000) WVPASS(not p.empty) WVEXCEPT(PipelineCloseRequest, p.read, 1000)
def test_long_1(self): p = Pipeline() p.add("foo") assert p.read(2) == "fo" p.add("bar") assert p.read(3) == "oba" p.backup("rocko") p.add(StringIO("soma")) assert p.read(1000) == "rockorsoma" assert p.read(1000) == "" assert p.empty p.add("X" * 10000) p.close_request() assert p.read(5000) == 'X' * 5000 p.backup('XXX') py.test.raises(PipelineClosed, p.add, "newstuff") assert not p.empty assert p.read(100000) == 'X' * 5003 assert not p.empty py.test.raises(PipelineCloseRequest, p.read, 1000) assert not p.empty py.test.raises(PipelineCloseRequest, p.read, 1000)