'Simple selector tests'

def test_simple_selection(self):

    body = "<p><input    name='a'value='1'/><input    name='b'value='2'/></p>"
    response = TextResponse(url='http://example.com', body=body, encoding='utf-8')
    sel = Selector(response)
    xl = sel.xpath('//input')
    self.assertEqual(2, len(xl))
    for x in xl:
        assert isinstance(x, Selector)
    self.assertEqual(sel.xpath('//input').extract(), [x.extract() for x in sel.xpath('//input')])
    self.assertEqual([x.extract() for x in sel.xpath("//input[@name='a']/@name")], [u'a'])
    self.assertEqual([x.extract() for x in sel.xpath("number(concat(//input[@name='a']/@value,    //input[@name='b']/@value))")], [u'12.0'])
    self.assertEqual(sel.xpath("concat('xpath',    'rules')").extract(), [u'xpathrules'])
    self.assertEqual([x.extract() for x in sel.xpath("concat(//input[@name='a']/@value,    //input[@name='b']/@value)")], [u'12'])
