示例#1
0
文件: __init__.py 项目: fusionbox/eek
 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
文件: __init__.py 项目: fusionbox/eek
 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
文件: __init__.py 项目: fusionbox/eek
 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
文件: __init__.py 项目: fusionbox/eek
 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
文件: __init__.py 项目: fusionbox/eek
 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
文件: __init__.py 项目: fusionbox/eek
 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)