mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-23 10:43:44 +00:00
selector.__repr__ test
This commit is contained in:
parent
e17866aaab
commit
daabc718a9
@ -36,6 +36,16 @@ class SelectorTestCase(unittest.TestCase):
|
||||
self.assertEqual([x.extract() for x in sel.xpath("concat(//input[@name='a']/@value, //input[@name='b']/@value)")],
|
||||
[u'12'])
|
||||
|
||||
def test_representation(self):
|
||||
body = u"<p><input name='{}' value='\xa9'/></p>".format(50 * 'b')
|
||||
response = TextResponse(url="http://example.com", body=body, encoding='utf8')
|
||||
sel = self.sscls(response)
|
||||
|
||||
self.assertEqual(
|
||||
map(repr, sel.xpath('//input/@name')),
|
||||
[u"<Selector xpath='//input/@name' data=u'{}'>".format(40 * 'b')]
|
||||
)
|
||||
|
||||
def test_select_unicode_query(self):
|
||||
body = u"<p><input name='\xa9' value='1'/></p>"
|
||||
response = TextResponse(url="http://example.com", body=body, encoding='utf8')
|
||||
|
Loading…
x
Reference in New Issue
Block a user