Skip to content

Commit 17d7347

Browse files
committed
update minimal parsel version, add deprecated classes for csstranslator modules, fix test
1 parent 01d948f commit 17d7347

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ queuelib
77
six>=1.5.2
88
PyDispatcher>=2.0.5
99
service_identity
10-
parsel>=0.9.0
10+
parsel>=0.9.1

scrapy/selector/csstranslator.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
from parsel.csstranslator import (
2-
ScrapyXPathExpr,
3-
TranslatorMixin,
4-
ScrapyGenericTranslator,
5-
ScrapyHTMLTranslator
6-
)
1+
from parsel.csstranslator import XPathExpr, GenericTranslator, HTMLTranslator
2+
from scrapy.utils.deprecate import create_deprecated_class
3+
4+
5+
ScrapyXPathExpr = create_deprecated_class(
6+
'ScrapyXPathExpr', XPathExpr,
7+
new_class_path='parsel.csstranslator.XPathExpr')
8+
9+
ScrapyGenericTranslator = create_deprecated_class(
10+
'ScrapyGenericTranslator', GenericTranslator,
11+
new_class_path='parsel.csstranslator.GenericTranslator')
12+
13+
ScrapyHTMLTranslator = create_deprecated_class(
14+
'ScrapyHTMLTranslator', HTMLTranslator,
15+
new_class_path='parsel.csstranslator.HTMLTranslator')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'pyOpenSSL',
4545
'cssselect>=0.9',
4646
'six>=1.5.2',
47-
'parsel>=0.9.0',
47+
'parsel>=0.9.1',
4848
'PyDispatcher>=2.0.5',
4949
'service_identity',
5050
],

tests/test_selector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_simple_selection(self):
4343
def test_deprecated_root_argument(self, warnings):
4444
root = etree.fromstring(u'<html/>')
4545
sel = self.sscls(_root=root)
46-
self.assertEqual(root, sel._root)
46+
self.assertIs(root, sel._root)
4747
warnings.warn.assert_called_once_with(
4848
'Argument `_root` is deprecated, use `root` instead',
4949
mock.ANY, stacklevel=2)

0 commit comments

Comments
 (0)