Beispiel #1
0
 def test_empty(self):
     parsed = parse_option_header('text/plain; charset=""')
     self.assertEqual(parsed, ('text/plain', {'charset': ''}))
Beispiel #2
0
 def test_quoted(self):
     parsed = parse_option_header('text/plain; charset="foo bar"')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo bar'}))
Beispiel #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'}))
Beispiel #4
0
 def test_iso8859_1(self):
     parsed = parse_option_header('text/plain; foo="bar\xfe"')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
Beispiel #5
0
 def test_whitespace(self):
     parsed = parse_option_header('text/plain;   charset=foo    ')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
Beispiel #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'})
Beispiel #7
0
 def test_plain(self):
     parsed = parse_option_header('text/plain')
     self.assertEqual(parsed, ('text/plain', {}))
Beispiel #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'}))
Beispiel #9
0
 def test_empty(self):
     parsed = parse_option_header('text/plain; charset=""')
     self.assertEqual(parsed, ('text/plain', {'charset': ''}))
Beispiel #10
0
 def test_quoted(self):
     parsed = parse_option_header('text/plain; charset="foo bar"')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo bar'}))
Beispiel #11
0
 def test_whitespace(self):
     parsed = parse_option_header('text/plain;   charset=foo    ')
     self.assertEqual(parsed, ('text/plain', {'charset': 'foo'}))
Beispiel #12
0
 def test_iso8859_1(self):
     parsed = parse_option_header('text/plain; foo="bar\xfe"')
     self.assertEqual(parsed, ('text/plain', {'foo': 'bar\xfe'}))
Beispiel #13
0
 def test_plain(self):
     parsed = parse_option_header('text/plain')
     self.assertEqual(parsed, ('text/plain', {}))
Beispiel #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'})