提交 11e62117 编写于 作者: M Mikhail Korobov

suggest scrapy.Selector in deprecation warnings

上级 2d380367
......@@ -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',
)
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册