示例#1
0
 def test_empty(self):
     parsed = parse_option_header('text/plain; charset=""')
     self.assertEqual(parsed, ('text/plain', {'charset': ''}))
示例#2
0
 def test_quoted(self):
     parsed = parse_option_header('text/plain; charset="foo bar"')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo bar'}))
示例#3
0
 def test_multiple(self):
     parsed = parse_option_header('text/plain; foo=bar baz=qux')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar', 'baz': 'qux'}))
示例#4
0
 def test_iso8859_1(self):
     parsed = parse_option_header('text/plain; foo="bar\xfe"')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
示例#5
0
 def test_whitespace(self):
     parsed = parse_option_header('text/plain;   charset=foo    ')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
示例#6
0
 def test_basic(self):
     parsed = parse_option_header('text/plain; charset=foo')
     self.assertIsInstance(parsed, tuple)
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], 'text/plain')
     self.assertEqual(parsed[1], {'charset': 'foo'})
示例#7
0
 def test_plain(self):
     parsed = parse_option_header('text/plain')
     self.assertEqual(parsed, ('text/plain', {}))
示例#8
0
 def test_multiple(self):
     parsed = parse_option_header('text/plain; foo=bar baz=qux')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar', 'baz': 'qux'}))
示例#9
0
 def test_empty(self):
     parsed = parse_option_header('text/plain; charset=""')
     self.assertEqual(parsed, ('text/plain', {'charset': ''}))
示例#10
0
 def test_quoted(self):
     parsed = parse_option_header('text/plain; charset="foo bar"')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo bar'}))
示例#11
0
 def test_whitespace(self):
     parsed = parse_option_header('text/plain;   charset=foo    ')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
示例#12
0
 def test_iso8859_1(self):
     parsed = parse_option_header('text/plain; foo="bar\xfe"')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
示例#13
0
 def test_plain(self):
     parsed = parse_option_header('text/plain')
     self.assertEqual(parsed, ('text/plain', {}))
示例#14
0
 def test_basic(self):
     parsed = parse_option_header('text/plain; charset=foo')
     self.assertIsInstance(parsed, tuple)
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], 'text/plain')
     self.assertEqual(parsed[1], {'charset': 'foo'})