Back to index

python3.2  3.2.2
Public Member Functions
test.test_wsgiref.HeaderTests Class Reference
Inheritance diagram for test.test_wsgiref.HeaderTests:
Inheritance graph
[legend]
Collaboration diagram for test.test_wsgiref.HeaderTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testMappingInterface
def testRequireList
def testExtras

Detailed Description

Definition at line 372 of file test_wsgiref.py.


Member Function Documentation

Definition at line 409 of file test_wsgiref.py.

00409 
00410     def testExtras(self):
00411         h = Headers([])
00412         self.assertEqual(str(h),'\r\n')
00413 
00414         h.add_header('foo','bar',baz="spam")
00415         self.assertEqual(h['foo'], 'bar; baz="spam"')
00416         self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n')
00417 
00418         h.add_header('Foo','bar',cheese=None)
00419         self.assertEqual(h.get_all('foo'),
00420             ['bar; baz="spam"', 'bar; cheese'])
00421 
00422         self.assertEqual(str(h),
00423             'foo: bar; baz="spam"\r\n'
00424             'Foo: bar; cheese\r\n'
00425             '\r\n'
00426         )

Here is the call graph for this function:

Definition at line 374 of file test_wsgiref.py.

00374 
00375     def testMappingInterface(self):
00376         test = [('x','y')]
00377         self.assertEqual(len(Headers([])),0)
00378         self.assertEqual(len(Headers(test[:])),1)
00379         self.assertEqual(Headers(test[:]).keys(), ['x'])
00380         self.assertEqual(Headers(test[:]).values(), ['y'])
00381         self.assertEqual(Headers(test[:]).items(), test)
00382         self.assertFalse(Headers(test).items() is test)  # must be copy!
00383 
00384         h=Headers([])
00385         del h['foo']   # should not raise an error
00386 
00387         h['Foo'] = 'bar'
00388         for m in h.__contains__, h.get, h.get_all, h.__getitem__:
00389             self.assertTrue(m('foo'))
00390             self.assertTrue(m('Foo'))
00391             self.assertTrue(m('FOO'))
00392             self.assertFalse(m('bar'))
00393 
00394         self.assertEqual(h['foo'],'bar')
00395         h['foo'] = 'baz'
00396         self.assertEqual(h['FOO'],'baz')
00397         self.assertEqual(h.get_all('foo'),['baz'])
00398 
00399         self.assertEqual(h.get("foo","whee"), "baz")
00400         self.assertEqual(h.get("zoo","whee"), "whee")
00401         self.assertEqual(h.setdefault("foo","whee"), "baz")
00402         self.assertEqual(h.setdefault("zoo","whee"), "whee")
00403         self.assertEqual(h["foo"],"baz")
00404         self.assertEqual(h["zoo"],"whee")

Here is the call graph for this function:

Definition at line 405 of file test_wsgiref.py.

00405 
00406     def testRequireList(self):
00407         self.assertRaises(TypeError, Headers, "foo")
00408 

Here is the call graph for this function:


The documentation for this class was generated from the following file: