MCPcopy Index your code
hub / github.com/python/cpython / test_replace_header

Method test_replace_header

Lib/test/test_email/test_email.py:669–684  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

667 self.assertEqual(msg.get_content_subtype(), 'plain')
668
669 def test_replace_header(self):
670 eq = self.assertEqual
671 msg = Message()
672 msg.add_header('First', 'One')
673 msg.add_header('Second', 'Two')
674 msg.add_header('Third', 'Three')
675 eq(msg.keys(), ['First', 'Second', 'Third'])
676 eq(msg.values(), ['One', 'Two', 'Three'])
677 msg.replace_header('Second', 'Twenty')
678 eq(msg.keys(), ['First', 'Second', 'Third'])
679 eq(msg.values(), ['One', 'Twenty', 'Three'])
680 msg.add_header('First', 'Eleven')
681 msg.replace_header('First', 'One Hundred')
682 eq(msg.keys(), ['First', 'Second', 'Third', 'First'])
683 eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven'])
684 self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing')
685
686 def test_get_content_disposition(self):
687 msg = Message()

Callers

nothing calls this directly

Calls 7

add_headerMethod · 0.95
keysMethod · 0.95
valuesMethod · 0.95
replace_headerMethod · 0.95
MessageClass · 0.90
eqFunction · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected