diff --git a/scrapy/tests/test_http_request.py b/scrapy/tests/test_http_request.py index 81b871451..e438a51ce 100644 --- a/scrapy/tests/test_http_request.py +++ b/scrapy/tests/test_http_request.py @@ -439,6 +439,27 @@ class FormRequestTest(RequestTest): self.assertRaises(ValueError, self.request_class.from_response, response, clickdata={'nonexistent': 'notme'}) + def test_from_response_nr_index_clickdata(self): + response = _buildresponse( + """
+ + +
+ """) + req = self.request_class.from_response(response, clickdata={'nr': 1}) + fs = _qs(req) + self.assertIn('clickable2', fs) + self.assertNotIn('clickable1', fs) + + def test_from_response_invalid_nr_index_clickdata(self): + response = _buildresponse( + """
+ +
+ """) + self.assertRaises(ValueError, self.request_class.from_response, + response, clickdata={'nr': 1}) + def test_from_response_errors_noform(self): response = _buildresponse("""""") self.assertRaises(ValueError, self.request_class.from_response, response)