def test_from_content_disposition(self): mappings = [ ('attachment; filename="data.xml"', XmlResponse), ('attachment; filename=data.xml', XmlResponse), ] for source, cls in mappings: retcls = responsetypes.from_content_disposition(source) assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)
def test_from_content_disposition(self): mappings = [ (b'attachment; filename="data.xml"', XmlResponse), (b'attachment; filename=data.xml', XmlResponse), (u'attachment;filename=data£.tar.gz'.encode('utf-8'), Response), (u'attachment;filename=dataµ.tar.gz'.encode('latin-1'), Response), (u'attachment;filename=data高.doc'.encode('gbk'), Response), (u'attachment;filename=دورهdata.html'.encode('cp720'), HtmlResponse), (u'attachment;filename=日本語版Wikipedia.xml'.encode('iso2022_jp'), XmlResponse), ] for source, cls in mappings: retcls = responsetypes.from_content_disposition(source) assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)
def test_from_content_disposition(self): mappings = [ (b'attachment; filename="data.xml"', XmlResponse), (b'attachment; filename=data.xml', XmlResponse), ('attachment;filename=data£.tar.gz'.encode('utf-8'), Response), ('attachment;filename=dataµ.tar.gz'.encode('latin-1'), Response), ('attachment;filename=data高.doc'.encode('gbk'), Response), ('attachment;filename=دورهdata.html'.encode('cp720'), HtmlResponse), ('attachment;filename=日本語版Wikipedia.xml'.encode('iso2022_jp'), XmlResponse), ] for source, cls in mappings: retcls = responsetypes.from_content_disposition(source) assert retcls is cls, f"{source} ==> {retcls} != {cls}"
def test_from_content_disposition(self): mappings = [ (b'attachment; filename="data.xml"', XmlResponse), (b"attachment; filename=data.xml", XmlResponse), ("attachment;filename=data£.tar.gz".encode("utf-8"), Response), ("attachment;filename=dataµ.tar.gz".encode("latin-1"), Response), ("attachment;filename=data高.doc".encode("gbk"), Response), ("attachment;filename=دورهdata.html".encode("cp720"), HtmlResponse), ("attachment;filename=日本語版Wikipedia.xml".encode("iso2022_jp"), XmlResponse), ] for source, cls in mappings: retcls = responsetypes.from_content_disposition(source) assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)