MCPcopy
hub / github.com/tornadoweb/tornado / test_copy

Method test_copy

tornado/test/httputil_test.py:499–514  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

497 )
498
499 def test_copy(self):
500 all_pairs = [("A", "1"), ("A", "2"), ("B", "c")]
501 h1 = HTTPHeaders()
502 for k, v in all_pairs:
503 h1.add(k, v)
504 h2 = h1.copy()
505 h3 = copy.copy(h1)
506 h4 = copy.deepcopy(h1)
507 for headers in [h1, h2, h3, h4]:
508 # All the copies are identical, no matter how they were
509 # constructed.
510 self.assertEqual(list(sorted(headers.get_all())), all_pairs)
511 for headers in [h2, h3, h4]:
512 # Neither the dict or its member lists are reused.
513 self.assertIsNot(headers, h1)
514 self.assertIsNot(headers.get_list("A"), h1.get_list("A"))
515
516 def test_pickle_roundtrip(self):
517 headers = HTTPHeaders()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected