From 3f2a4b2d89d66daa64cd3cf9bf31efd25702a0a9 Mon Sep 17 00:00:00 2001 From: zheng yin Date: Fri, 9 Sep 2016 11:13:15 +0800 Subject: [PATCH] Add test_pop in the test_header_key_dict There is a pop() function in the header_key_dict, but it has no test_pop in the test_header_key_dict. Therefore, I add it. Change-Id: I97bf9729fae3f044bcc69014549137f45ecbe91b --- test/unit/common/test_header_key_dict.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/unit/common/test_header_key_dict.py b/test/unit/common/test_header_key_dict.py index 5f3f669704..dee1fa0544 100644 --- a/test/unit/common/test_header_key_dict.py +++ b/test/unit/common/test_header_key_dict.py @@ -47,9 +47,9 @@ class TestHeaderKeyDict(unittest.TestCase): def test_del_contains(self): headers = HeaderKeyDict() headers['Content-Length'] = 0 - self.assertTrue('Content-Length' in headers) + self.assertIn('Content-Length', headers) del headers['Content-Length'] - self.assertTrue('Content-Length' not in headers) + self.assertNotIn('Content-Length', headers) def test_update(self): headers = HeaderKeyDict() @@ -73,3 +73,12 @@ class TestHeaderKeyDict(unittest.TestCase): self.assertEqual( set(headers.keys()), set(('Content-Length', 'Content-Type', 'Something-Else'))) + + def test_pop(self): + headers = HeaderKeyDict() + headers['content-length'] = 20 + headers['cOntent-tYpe'] = 'text/plain' + self.assertEqual(headers.pop('content-Length'), '20') + self.assertEqual(headers.pop('Content-type'), 'text/plain') + self.assertEqual(headers.pop('Something-Else', 'somevalue'), + 'somevalue')