Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
looyolo
scrapy
提交
11e62117
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,发现更多精彩内容 >>
提交
11e62117
编写于
4月 10, 2014
作者:
M
Mikhail Korobov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
suggest scrapy.Selector in deprecation warnings
上级
2d380367
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
10 deletion
+10
-10
scrapy/selector/lxmlsel.py
scrapy/selector/lxmlsel.py
+4
-4
scrapy/tests/test_selector.py
scrapy/tests/test_selector.py
+6
-6
未找到文件。
scrapy/selector/lxmlsel.py
浏览文件 @
11e62117
...
...
@@ -10,7 +10,7 @@ __all__ = ['HtmlXPathSelector', 'XmlXPathSelector', 'XPathSelector',
def
_xpathselector_css
(
self
,
*
a
,
**
kw
):
raise
RuntimeError
(
'.css() method not available for %s, '
'instantiate scrapy.
selector.
Selector '
'instantiate scrapy.Selector '
'instead'
%
type
(
self
).
__name__
)
XPathSelector
=
create_deprecated_class
(
...
...
@@ -21,7 +21,7 @@ XPathSelector = create_deprecated_class(
'_default_type'
:
'html'
,
'css'
:
_xpathselector_css
,
},
new_class_path
=
'scrapy.
selector.
Selector'
,
new_class_path
=
'scrapy.Selector'
,
old_class_path
=
'scrapy.selector.XPathSelector'
,
)
...
...
@@ -32,7 +32,7 @@ XmlXPathSelector = create_deprecated_class(
'__slots__'
:
(),
'_default_type'
:
'xml'
,
},
new_class_path
=
'scrapy.
selector.
Selector'
,
new_class_path
=
'scrapy.Selector'
,
old_class_path
=
'scrapy.selector.XmlXPathSelector'
,
)
...
...
@@ -43,7 +43,7 @@ HtmlXPathSelector = create_deprecated_class(
'__slots__'
:
(),
'_default_type'
:
'html'
,
},
new_class_path
=
'scrapy.
selector.
Selector'
,
new_class_path
=
'scrapy.Selector'
,
old_class_path
=
'scrapy.selector.HtmlXPathSelector'
,
)
...
...
scrapy/tests/test_selector.py
浏览文件 @
11e62117
...
...
@@ -354,7 +354,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# subclassing must issue a warning
self
.
assertEqual
(
len
(
w
),
1
,
str
(
cls
))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
0
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
0
].
message
))
# subclass instance doesn't issue a warning
usel
=
UserClass
(
text
=
self
.
text
)
...
...
@@ -363,7 +363,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# class instance must issue a warning
sel
=
cls
(
text
=
self
.
text
)
self
.
assertEqual
(
len
(
w
),
2
,
str
((
cls
,
[
x
.
message
for
x
in
w
])))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
1
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
1
].
message
))
# subclass and instance checks
self
.
assertTrue
(
issubclass
(
cls
,
Selector
))
...
...
@@ -378,7 +378,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# subclassing must issue a warning
self
.
assertEqual
(
len
(
w
),
1
,
str
(
cls
))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
0
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
0
].
message
))
# subclass instance doesn't issue a warning
usel
=
UserClass
(
text
=
self
.
text
)
...
...
@@ -387,7 +387,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# class instance must issue a warning
sel
=
cls
(
text
=
self
.
text
)
self
.
assertEqual
(
len
(
w
),
2
,
str
((
cls
,
[
x
.
message
for
x
in
w
])))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
1
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
1
].
message
))
# subclass and instance checks
self
.
assertTrue
(
issubclass
(
cls
,
Selector
))
...
...
@@ -405,7 +405,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# subclassing must issue a warning
self
.
assertEqual
(
len
(
w
),
1
,
str
(
cls
))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
0
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
0
].
message
))
# subclass instance doesn't issue a warning
usel
=
UserClass
(
text
=
self
.
text
)
...
...
@@ -414,7 +414,7 @@ class DeprecatedXpathSelectorTest(unittest.TestCase):
# class instance must issue a warning
sel
=
cls
(
text
=
self
.
text
)
self
.
assertEqual
(
len
(
w
),
2
,
str
((
cls
,
[
x
.
message
for
x
in
w
])))
self
.
assertIn
(
'scrapy.
selector.
Selector'
,
str
(
w
[
1
].
message
))
self
.
assertIn
(
'scrapy.Selector'
,
str
(
w
[
1
].
message
))
# subclass and instance checks
self
.
assertTrue
(
issubclass
(
cls
,
Selector
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录