@pytest.mark.parametrize('template', ['{}', 'attachment; filename="{}"', 'inline; {}', 'attachment; {}="foo"', 'attachment; filename*=iso-8859-1{}', 'attachment; filename*={}'])
@hypothesis.given(strategies.text(alphabet=[chr(x) for x in range(255)]))
def test_parse_content_disposition(caplog, template, stubs, s):
 header = template.format(s)
 reply = stubs.FakeNetworkReply(headers={'Content-Disposition': header})
 with caplog.at_level(logging.ERROR, 'rfc6266'):
  http.parse_content_disposition(reply)

@ pytest . mark . parametrize ( 'template' , [ '{}' , 'attachment; filename="{}"' , 'inline; {}' , 'attachment; {}="foo"' , 'attachment; filename*=iso-8859-1{}' , 'attachment; filename*={}' ] ) @ hypothesis . given ( strategies . text ( alphabet = [ chr ( x ) for x in range ( 255 ) ] ) ) def test_parse_content_disposition ( caplog , template , stubs , s ) : header = template . format ( s ) reply = stubs . FakeNetworkReply ( headers = { 'Content-Disposition' : header } ) with caplog . at_level ( logging . ERROR , 'rfc6266' ) : http . parse_content_disposition ( reply )
test parsing headers based on templates which hypothesis completes .