mirror of https://github.com/scrapy/scrapy.git
make trial run doctests
This commit is contained in:
parent
a3a108dc71
commit
1ead888db8
|
|
@ -13,6 +13,8 @@ from scrapy.contrib.ibl.extractors import (contains_any_numbers,
|
|||
|
||||
try:
|
||||
import numpy
|
||||
__doctests__ = ['scrapy.contrib.ibl.extraction.%s' % x for x in \
|
||||
['regionextract', 'similarity', 'pageobjects']]
|
||||
except ImportError:
|
||||
numpy = None
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
try:
|
||||
import numpy
|
||||
__doctests__ = ['scrapy.contrib.ibl.extractors']
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -3,6 +3,8 @@ import unittest
|
|||
|
||||
from scrapy.utils.datatypes import PriorityQueue, PriorityStack, CaselessDict
|
||||
|
||||
__doctests__ = ['scrapy.utils.datatypes']
|
||||
|
||||
# (ITEM, PRIORITY)
|
||||
INPUT = [(1, -5), (30, -1), (80, -3), (4, 1), (6, 3), (20, 0), (50, -1)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import unittest
|
||||
from scrapy.utils.http import basic_auth_header
|
||||
|
||||
__doctests__ = ['scrapy.utils.http']
|
||||
|
||||
class UtilsHttpTestCase(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ from cStringIO import StringIO
|
|||
|
||||
from scrapy.utils.misc import load_object, arg_to_iter, walk_modules
|
||||
|
||||
__doctests__ = ['scrapy.utils.misc']
|
||||
|
||||
class UtilsMiscTestCase(unittest.TestCase):
|
||||
|
||||
def test_load_object(self):
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ from scrapy.utils.python import str_to_unicode, unicode_to_str, \
|
|||
memoizemethod_noargs, isbinarytext, equal_attributes, \
|
||||
WeakKeyCache, stringify_dict
|
||||
|
||||
__doctests__ = ['scrapy.utils.python']
|
||||
|
||||
class UtilsPythonTestCase(unittest.TestCase):
|
||||
def test_str_to_unicode(self):
|
||||
# converting an utf-8 encoded string to unicode
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ from scrapy.http import Response, TextResponse, HtmlResponse
|
|||
from scrapy.utils.response import body_or_str, get_base_url, get_meta_refresh, \
|
||||
response_httprepr, get_cached_beautifulsoup, open_in_browser
|
||||
|
||||
__doctests__ = ['scrapy.utils.response']
|
||||
|
||||
class ResponseUtilsTest(unittest.TestCase):
|
||||
dummy_response = TextResponse(url='http://example.org/', body='dummy_response')
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
__doctests__ = ['scrapy.utils.template']
|
||||
|
|
@ -72,10 +72,10 @@ def response_status_message(status):
|
|||
"""Return status code plus status text descriptive message
|
||||
|
||||
>>> response_status_message(200)
|
||||
200 OK
|
||||
'200 OK'
|
||||
|
||||
>>> response_status_message(404)
|
||||
404 Not Found
|
||||
'404 Not Found'
|
||||
"""
|
||||
return '%s %s' % (status, http.responses.get(int(status)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue