Пример #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)
Пример #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'))
Пример #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'))
Пример #4
0
 def task_page(self, dummy_grab, task):
     yield Data('foo', count=task.get('count', 1))
Пример #5
0
 def task_page(self, dummy_grab, dummy_task):
     yield Data('foo', one=1, two=2, bar='gaz')
Пример #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})
Пример #7
0
 def task_page(self, grab, task):
     yield Data('foo', one=1, two=2, bar='gaz')
Пример #8
0
 def task_page(self, dummy_grab, dummy_task):
     yield Data('foo', number=1)
Пример #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)
Пример #10
0
 def task_page(self, grab, task):
     yield Data('foo', number=1)
Пример #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"))
Пример #12
0
 def task_page(self, unused_grab, unused_task):
     yield Data('foo', one=1, two=2, bar='gaz')
Пример #13
0
 def task_page(self, unused_grab, unused_task):
     yield Data('foo', number=1)
Пример #14
0
 def task_initial(self, grab, task):
     yield Data('foo', dict(name='Alice'))
Пример #15
0
 def task_baz(self, grab, task):
     return Data('foo', grab.response.body)