def test_param_multiple_missing_semi(self): parsed = parse_content_type('text/plain; foo=bar baz=qux') self.assertEqual(parsed, ('text/plain', {'foo': 'bar'}))
def test_param_empty(self): parsed = parse_content_type('text/plain; charset=""') self.assertEqual(parsed, ('text/plain', {'charset': ''}))
def test_param_multiple(self): parsed = parse_content_type('text/plain; foo=bar; baz=qux') self.assertEqual(parsed, ('text/plain', {'foo': 'bar', 'baz': 'qux'}))
def test_param_whitespace(self): parsed = parse_content_type('text/plain; charset=foo ') self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
def test_param_quoted_pair(self): parsed = parse_content_type('text/plain; charset="foo\\"bar"') self.assertEqual(parsed, ('text/plain', {'charset': 'foo"bar'}))
def test_params(self): parsed = parse_content_type('text/plain; charset=foo') self.assertEqual(parsed[0], 'text/plain') self.assertEqual(parsed[1], {'charset': 'foo'})
def test_iso8859_1(self): parsed = parse_content_type('text/plain; foo="bar\xfe"') self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
def test_param_multiple_missing_semi(self): parsed = parse_content_type('text/plain; foo=bar baz=qux') self.assertEqual(parsed, ('text/plain', {'foo': 'bar'}))
def test_simple(self): parsed = parse_content_type('text/plain') self.assertEqual(parsed, ('text/plain', {}))
def test_param_empty(self): parsed = parse_content_type('text/plain; charset=""') self.assertEqual(parsed, ('text/plain', {'charset': ''}))
def test_param_multiple(self): parsed = parse_content_type('text/plain; foo=bar; baz=qux') self.assertEqual(parsed, ('text/plain', {'foo': 'bar', 'baz': 'qux'}))
def test_param_quoted_pair(self): parsed = parse_content_type('text/plain; charset="foo\\"bar"') self.assertEqual(parsed, ('text/plain', {'charset': 'foo"bar'}))
def test_param_whitespace(self): parsed = parse_content_type('text/plain; charset=foo ') self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
def test_iso8859_1(self): parsed = parse_content_type('text/plain; foo="bar\xfe"') self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
def test_params(self): parsed = parse_content_type('text/plain; charset=foo') self.assertEqual(parsed[0], 'text/plain') self.assertEqual(parsed[1], {'charset': 'foo'})
def test_simple(self): parsed = parse_content_type('text/plain') self.assertEqual(parsed, ('text/plain', {}))