<s> import pytest <EOL> from cocopot . http import parse_content_type , parse_auth , parse_date , http_date , html_quote , parse_range_header <EOL> from cocopot . exceptions import abort , HTTPException , MethodNotAllowed <EOL> import copy <EOL> import time <EOL> from datetime import datetime <EOL> def test_content_type ( ) : <EOL> r = parse_content_type ( '<STR_LIT>' ) <EOL> assert r == ( '<STR_LIT>' , { } ) <EOL> r = parse_content_type ( '<STR_LIT>' ) <EOL> assert r == ( '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT:utf-8>' } ) <EOL> def test_http_date ( ) : <EOL> t = time . time ( ) <EOL> assert http_date ( t ) == time . strftime ( "<STR_LIT>" , time . gmtime ( t ) ) <EOL> def test_auth ( ) : <EOL> assert None == parse_auth ( '<STR_LIT::>' ) <EOL> assert None == parse_auth ( '<STR_LIT>' ) <EOL> def test_range_header ( ) : <EOL> rv = list ( parse_range_header ( '<STR_LIT>' ) ) <EOL> assert rv == [ ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT:1000> ) ) <EOL> assert rv == [ ( <NUM_LIT> , <NUM_LIT:1000> ) ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT:1000> ) ) <EOL> assert rv == [ ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT:1000> ) ) <EOL> assert rv == [ ( <NUM_LIT> , <NUM_LIT:100> ) ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT> ) ) <EOL> assert rv == [ ( <NUM_LIT> , <NUM_LIT:100> ) , ( <NUM_LIT:1000> , <NUM_LIT> ) ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT:1000> ) ) <EOL> assert rv == [ ] <EOL> rv = list ( parse_range_header ( '<STR_LIT>' , <NUM_LIT:1000> ) ) <EOL> assert rv == [ ] <EOL> def test_html ( ) : <EOL> assert '<STR_LIT>' == html_quote ( '<STR_LIT>' ) <EOL> def test_exception ( ) : <EOL> exc = HTTPException ( ) <EOL> assert exc . get_description ( ) == '<STR_LIT>' <EOL> assert exc . name == '<STR_LIT>' <EOL> assert exc . get_body ( ) == '<STR_LIT>' <EOL> s = repr ( exc ) </s>
