Example #1
0
 def data_foo(self, count):
     self.data_processed.append(count)
     if count == 1:
         yield Data('foo', count=666)
         yield Task('page', url=server.get_url(),
                    count=count + 1)
Example #2
0
 def test_data_object_get_method(self):
     data = Data('person', person={'age': 22})
     self.assertRaises(KeyError, lambda: data.get('name'))
     self.assertEqual('foo', data.get('name', 'foo'))
     self.assertEqual({'age': 22}, data.get('person'))
Example #3
0
 def test_data_object_get_method(self):
     data = Data('person', person={'age': 22})
     self.assertRaises(KeyError, lambda: data.get('name'))
     self.assertEqual('foo', data.get('name', 'foo'))
     self.assertEqual({'age': 22}, data.get('person'))
Example #4
0
 def task_page(self, dummy_grab, task):
     yield Data('foo', count=task.get('count', 1))
Example #5
0
 def task_page(self, dummy_grab, dummy_task):
     yield Data('foo', one=1, two=2, bar='gaz')
Example #6
0
 def test_data_object_dict_interface(self):
     data = Data('person', person={'age': 22})
     self.assertRaises(KeyError, lambda: data['name'])
     self.assertEqual(data['person'], {'age': 22})
Example #7
0
 def task_page(self, grab, task):
     yield Data('foo', one=1, two=2, bar='gaz')
Example #8
0
 def task_page(self, dummy_grab, dummy_task):
     yield Data('foo', number=1)
Example #9
0
 def data_foo(self, count):
     self.data_processed.append(count)
     if count == 1:
         yield Data('foo', count=666)
         yield Task('page', url=SERVER.BASE_URL, count=count + 1)
Example #10
0
 def task_page(self, grab, task):
     yield Data('foo', number=1)
Example #11
0
 def test_data_object_get_method(self):
     data = Data("person", person={"age": 22})
     self.assertRaises(KeyError, lambda: data.get("name"))
     self.assertEqual("foo", data.get("name", "foo"))
     self.assertEqual({"age": 22}, data.get("person"))
Example #12
0
 def task_page(self, unused_grab, unused_task):
     yield Data('foo', one=1, two=2, bar='gaz')
Example #13
0
 def task_page(self, unused_grab, unused_task):
     yield Data('foo', number=1)
Example #14
0
 def task_initial(self, grab, task):
     yield Data('foo', dict(name='Alice'))
Example #15
0
 def task_baz(self, grab, task):
     return Data('foo', grab.response.body)