MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_copy

Method test_copy

python/python3/tornado/test/httputil_test.py:346–361  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

344 )
345
346 def test_copy(self):
347 all_pairs = [("A", "1"), ("A", "2"), ("B", "c")]
348 h1 = HTTPHeaders()
349 for k, v in all_pairs:
350 h1.add(k, v)
351 h2 = h1.copy()
352 h3 = copy.copy(h1)
353 h4 = copy.deepcopy(h1)
354 for headers in [h1, h2, h3, h4]:
355 # All the copies are identical, no matter how they were
356 # constructed.
357 self.assertEqual(list(sorted(headers.get_all())), all_pairs)
358 for headers in [h2, h3, h4]:
359 # Neither the dict or its member lists are reused.
360 self.assertIsNot(headers, h1)
361 self.assertIsNot(headers.get_list("A"), h1.get_list("A"))
362
363 def test_pickle_roundtrip(self):
364 headers = HTTPHeaders()

Callers

nothing calls this directly

Calls 6

addMethod · 0.95
copyMethod · 0.95
get_listMethod · 0.95
HTTPHeadersClass · 0.90
listFunction · 0.85
get_allMethod · 0.80

Tested by

no test coverage detected