def test_negotiated_resource_is_instantiable(): website = Website([]) fs = '' raw = '[---]\n[---] text/plain via stdlib_template\n' media_type = '' mtime = 0 actual = NegotiatedResource(website, fs, raw, media_type, mtime).__class__ assert actual is NegotiatedResource
def get(**_kw): kw = dict(website=Website([]), fs='', raw='[---]\n[---] text/plain via stdlib_template\n', media_type='', mtime=0) kw.update(_kw) return NegotiatedResource(**kw)
def test_negotiated_resource_is_instantiable(): website = Website([]) fs = '' raw = '^L^L #!tornado text/plain\n' media_type = '' mtime = 0 actual = NegotiatedResource(website, fs, raw, media_type, mtime).__class__ assert actual is NegotiatedResource, actual
def parse_into_pages(self, raw): """Extend to insert page one if needed. """ pages = NegotiatedResource.parse_into_pages(self, raw) npages = len(pages) assert npages in (2, 3, 4), npages # sanity check if npages == 2: pages = [''] + pages return pages
def get(**_kw): kw = dict( website = Website([]) , fs = '' , raw = '^L^L #!tornado text/plain\n' , media_type = '' , mtime = 0 ) kw.update(_kw) return NegotiatedResource(**kw)
def parse_into_pages(self, raw): """Extend to insert page one if needed. """ pages = NegotiatedResource.parse_into_pages(self, raw) self._prepend_empty_pages(pages, 3) return pages