def test_seekable(self): h = SeekableProcessor() o = h.parent = MockOpener() req = urllib2.Request("http://example.com/") class MockUnseekableResponse: pass r = MockUnseekableResponse() newr = h.http_response(req, r) self.assert_(not hasattr(r, "seek")) self.assert_(hasattr(newr, "seek"))
def test_seekable(self): h = SeekableProcessor() o = h.parent = MockOpener() req = urllib2.Request("http://example.com/") class MockUnseekableResponse: code = 200 msg = "OK" def info(self): pass def geturl(self): return "" r = MockUnseekableResponse() newr = h.http_response(req, r) self.assert_(not hasattr(r, "seek")) self.assert_(hasattr(newr, "seek"))