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

Method test_add_header

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

Source from the content-addressed store, hash-verified

1635 self.assertEqual(au.get_content_type(), 'audio/fish')
1636
1637 def test_add_header(self):
1638 self._make_audio('au')
1639 eq = self.assertEqual
1640 self._au.add_header('Content-Disposition', 'attachment',
1641 filename='sndhdr.au')
1642 eq(self._au['content-disposition'],
1643 'attachment; filename="sndhdr.au"')
1644 eq(self._au.get_params(header='content-disposition'),
1645 [('attachment', ''), ('filename', 'sndhdr.au')])
1646 eq(self._au.get_param('filename', header='content-disposition'),
1647 'sndhdr.au')
1648 missing = []
1649 eq(self._au.get_param('attachment', header='content-disposition'), '')
1650 self.assertIs(self._au.get_param(
1651 'foo', failobj=missing,
1652 header='content-disposition'), missing)
1653 # Try some missing stuff
1654 self.assertIs(self._au.get_param('foobar', missing), missing)
1655 self.assertIs(self._au.get_param('attachment', missing,
1656 header='foobar'), missing)
1657
1658
1659

Callers

nothing calls this directly

Calls 6

_make_audioMethod · 0.95
eqFunction · 0.85
get_paramsMethod · 0.80
get_paramMethod · 0.80
add_headerMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected