Пример #1
0
 def test_raise_NotHtmlException_on_messed_up_content_type(self):
     from eek.spider import beautify, NotHtmlException
     response = self.MockResponse('foo', '<!doctype html><p>Hello</p>')
     with self.assertRaises(NotHtmlException):
         beautify(response)
Пример #2
0
 def test_return_not_none_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html; charset=utf-8',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNotNone(result.original_encoding)
Пример #3
0
 def test_return_no_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNone(result.fromEncoding)
Пример #4
0
 def test_raise_NotHtmlException_on_messed_up_content_type(self):
     from eek.spider import beautify, NotHtmlException
     response = self.MockResponse('foo',
                                  '<!doctype html><p>Hello</p>')
     with self.assertRaises(NotHtmlException):
         beautify(response)
Пример #5
0
 def test_return_not_none_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html; charset=utf-8',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNotNone(result.original_encoding)
Пример #6
0
 def test_return_no_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNone(result.fromEncoding)