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)
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'))
def task_page(self, dummy_grab, task): yield Data('foo', count=task.get('count', 1))
def task_page(self, dummy_grab, dummy_task): yield Data('foo', one=1, two=2, bar='gaz')
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})
def task_page(self, grab, task): yield Data('foo', one=1, two=2, bar='gaz')
def task_page(self, dummy_grab, dummy_task): yield Data('foo', number=1)
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)
def task_page(self, grab, task): yield Data('foo', number=1)
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"))
def task_page(self, unused_grab, unused_task): yield Data('foo', one=1, two=2, bar='gaz')
def task_page(self, unused_grab, unused_task): yield Data('foo', number=1)
def task_initial(self, grab, task): yield Data('foo', dict(name='Alice'))
def task_baz(self, grab, task): return Data('foo', grab.response.body)