Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
looyolo
scrapy
提交
fd27cde2
S
scrapy
项目概览
looyolo
/
scrapy
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
scrapy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fd27cde2
编写于
8月 08, 2017
作者:
C
Chomba Ng'ang'a
提交者:
Paul Tremberth
8月 09, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update asserts to use more generic ones
上级
4ca61a20
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
11 addition
and
11 deletion
+11
-11
tests/test_http_cookies.py
tests/test_http_cookies.py
+1
-1
tests/test_http_request.py
tests/test_http_request.py
+2
-2
tests/test_loader.py
tests/test_loader.py
+3
-3
tests/test_utils_python.py
tests/test_utils_python.py
+3
-3
tests/test_utils_signal.py
tests/test_utils_signal.py
+1
-1
tests/test_webclient.py
tests/test_webclient.py
+1
-1
未找到文件。
tests/test_http_cookies.py
浏览文件 @
fd27cde2
...
...
@@ -62,7 +62,7 @@ class WrappedResponseTest(TestCase):
self
.
wrapped
=
WrappedResponse
(
self
.
response
)
def
test_info
(
self
):
self
.
assert
True
(
self
.
wrapped
.
info
()
is
self
.
wrapped
)
self
.
assert
Is
(
self
.
wrapped
.
info
(),
self
.
wrapped
)
def
test_getheaders
(
self
):
self
.
assertEqual
(
self
.
wrapped
.
getheaders
(
'content-type'
),
[
'text/html'
])
...
...
tests/test_http_request.py
浏览文件 @
fd27cde2
...
...
@@ -64,9 +64,9 @@ class RequestTest(unittest.TestCase):
h
=
Headers
({
'key1'
:
u
'val1'
,
u
'key2'
:
'val2'
})
h
[
u
'newkey'
]
=
u
'newval'
for
k
,
v
in
h
.
iteritems
():
self
.
assert
True
(
isinstance
(
k
,
bytes
)
)
self
.
assert
IsInstance
(
k
,
bytes
)
for
s
in
v
:
self
.
assert
True
(
isinstance
(
s
,
bytes
)
)
self
.
assert
IsInstance
(
s
,
bytes
)
def
test_eq
(
self
):
url
=
'http://www.scrapy.org'
...
...
tests/test_loader.py
浏览文件 @
fd27cde2
...
...
@@ -437,7 +437,7 @@ class ProcessorsTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
proc
,
[
None
,
''
,
'hello'
,
'world'
])
self
.
assertEqual
(
proc
([
''
,
'hello'
,
'world'
]),
u
' hello world'
)
self
.
assertEqual
(
proc
([
'hello'
,
'world'
]),
u
'hello world'
)
self
.
assert
True
(
isinstance
(
proc
([
'hello'
,
'world'
]),
six
.
text_type
)
)
self
.
assert
IsInstance
(
proc
([
'hello'
,
'world'
]),
six
.
text_type
)
def
test_compose
(
self
):
proc
=
Compose
(
lambda
v
:
v
[
0
],
str
.
upper
)
...
...
@@ -482,7 +482,7 @@ class SelectortemLoaderTest(unittest.TestCase):
def
test_constructor_with_selector
(
self
):
sel
=
Selector
(
text
=
u
"<html><body><div>marta</div></body></html>"
)
l
=
TestItemLoader
(
selector
=
sel
)
self
.
assert
True
(
l
.
selector
is
sel
)
self
.
assert
Is
(
l
.
selector
,
sel
)
l
.
add_xpath
(
'name'
,
'//div/text()'
)
self
.
assertEqual
(
l
.
get_output_value
(
'name'
),
[
u
'Marta'
])
...
...
@@ -490,7 +490,7 @@ class SelectortemLoaderTest(unittest.TestCase):
def
test_constructor_with_selector_css
(
self
):
sel
=
Selector
(
text
=
u
"<html><body><div>marta</div></body></html>"
)
l
=
TestItemLoader
(
selector
=
sel
)
self
.
assert
True
(
l
.
selector
is
sel
)
self
.
assert
Is
(
l
.
selector
,
sel
)
l
.
add_css
(
'name'
,
'div::text'
)
self
.
assertEqual
(
l
.
get_output_value
(
'name'
),
[
u
'Marta'
])
...
...
tests/test_utils_python.py
浏览文件 @
fd27cde2
...
...
@@ -156,7 +156,7 @@ class UtilsPythonTestCase(unittest.TestCase):
d
=
{
'a'
:
123
,
u
'b'
:
b
'c'
,
u
'd'
:
u
'e'
,
object
():
u
'e'
}
d2
=
stringify_dict
(
d
,
keys_only
=
False
)
self
.
assertEqual
(
d
,
d2
)
self
.
assert
False
(
d
is
d2
)
# shouldn't modify in place
self
.
assert
IsNot
(
d
,
d2
)
# shouldn't modify in place
self
.
assertFalse
(
any
(
isinstance
(
x
,
six
.
text_type
)
for
x
in
d2
.
keys
()))
self
.
assertFalse
(
any
(
isinstance
(
x
,
six
.
text_type
)
for
x
in
d2
.
values
()))
...
...
@@ -166,7 +166,7 @@ class UtilsPythonTestCase(unittest.TestCase):
d
=
dict
(
tuples
)
d2
=
stringify_dict
(
tuples
,
keys_only
=
False
)
self
.
assertEqual
(
d
,
d2
)
self
.
assert
False
(
d
is
d2
)
# shouldn't modify in place
self
.
assert
IsNot
(
d
,
d2
)
# shouldn't modify in place
self
.
assertFalse
(
any
(
isinstance
(
x
,
six
.
text_type
)
for
x
in
d2
.
keys
()),
d2
.
keys
())
self
.
assertFalse
(
any
(
isinstance
(
x
,
six
.
text_type
)
for
x
in
d2
.
values
()))
...
...
@@ -175,7 +175,7 @@ class UtilsPythonTestCase(unittest.TestCase):
d
=
{
'a'
:
123
,
u
'b'
:
'c'
,
u
'd'
:
u
'e'
,
object
():
u
'e'
}
d2
=
stringify_dict
(
d
)
self
.
assertEqual
(
d
,
d2
)
self
.
assert
False
(
d
is
d2
)
# shouldn't modify in place
self
.
assert
IsNot
(
d
,
d2
)
# shouldn't modify in place
self
.
assertFalse
(
any
(
isinstance
(
x
,
six
.
text_type
)
for
x
in
d2
.
keys
()))
def
test_get_func_args
(
self
):
...
...
tests/test_utils_signal.py
浏览文件 @
fd27cde2
...
...
@@ -29,7 +29,7 @@ class SendCatchLogTest(unittest.TestCase):
self
.
assertIn
(
'error_handler'
,
record
.
getMessage
())
self
.
assertEqual
(
record
.
levelname
,
'ERROR'
)
self
.
assertEqual
(
result
[
0
][
0
],
self
.
error_handler
)
self
.
assert
True
(
isinstance
(
result
[
0
][
1
],
Failure
)
)
self
.
assert
IsInstance
(
result
[
0
][
1
],
Failure
)
self
.
assertEqual
(
result
[
1
],
(
self
.
ok_handler
,
"OK"
))
dispatcher
.
disconnect
(
self
.
error_handler
,
signal
=
test_signal
)
...
...
tests/test_webclient.py
浏览文件 @
fd27cde2
...
...
@@ -326,7 +326,7 @@ class WebClientTestCase(unittest.TestCase):
return
getPage
(
self
.
getURL
(
'notsuchfile'
)).
addCallback
(
self
.
_cbNoSuchFile
)
def
_cbNoSuchFile
(
self
,
pageData
):
self
.
assert
True
(
b
'404 - No Such Resource'
in
pageData
)
self
.
assert
In
(
b
'404 - No Such Resource'
,
pageData
)
def
testFactoryInfo
(
self
):
url
=
self
.
getURL
(
'file'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录