def test_undecodable_content(self):
     response = self.fetch('https://www.cl.cam.ac.uk/~mgk25/'
                           'ucs/examples/UTF-8-test.txt')
     with self.assertRaises(UndecodableContentError):
         df._decode_body(response, 'a', False)
 def test_treats_unknown_encoding_as_ascii(self):
     response = mock_tornado_request('unknown_encoding.html')
     df._decode_body(response, 'a')
 def test_poorly_encoded_content(self):
     response = mock_tornado_request('poorly_encoded_utf8.txt')
     df._decode_body(response, 'a')
 def test_undecodable_content(self):
     response = mock_tornado_request('simple.pdf')
     with self.assertRaises(UndecodableContentError):
         df._decode_body(response, 'a')
 def test_decode_empty_bodies(self):
     response = mock_tornado_request('empty.txt')
     df._decode_body(response, 'a')