def test_no_modify(self): headers = {b'key': b'val'} result = transport.clean_headers(headers) self.assertIsNot(result, headers) self.assertEqual(result, headers)
def test_unicode_failure(self): headers = {u'key': u'\u2603'} with self.assertRaises(client.NonAsciiHeaderError): transport.clean_headers(headers)
def test_cast_object(self): headers = {b'key': True} header_str = {b'key': b'True'} result = transport.clean_headers(headers) self.assertIsNot(result, headers) self.assertEqual(result, header_str)
def test_cast_unicode(self): headers = {u'key': u'val'} header_bytes = {b'key': b'val'} result = transport.clean_headers(headers) self.assertIsNot(result, headers) self.assertEqual(result, header_bytes)