@@ -40,8 +40,8 @@ def tearDown(self):
40
40
def testTaskAddedToQueue (self ):
41
41
taskqueue .Task (name = 'my_task' , url = '/url/of/my/task/' ).add ()
42
42
tasks = self .taskqueue_stub .get_filtered_tasks ()
43
- assert len (tasks ) == 1
44
- assert tasks [0 ].name == 'my_task'
43
+ self . assertEqual ( len (tasks ), 1 )
44
+ self . assertEqual ( tasks [0 ].name , 'my_task' )
45
45
# [END taskqueue]
46
46
47
47
# [START filtering]
@@ -51,38 +51,38 @@ def testFiltering(self):
51
51
52
52
# All tasks
53
53
tasks = self .taskqueue_stub .get_filtered_tasks ()
54
- assert len (tasks ) == 2
54
+ self . assertEqual ( len (tasks ), 2 )
55
55
56
56
# Filter by name
57
57
tasks = self .taskqueue_stub .get_filtered_tasks (name = 'task_one' )
58
- assert len (tasks ) == 1
59
- assert tasks [0 ].name == 'task_one'
58
+ self . assertEqual ( len (tasks ), 1 )
59
+ self . assertEqual ( tasks [0 ].name , 'task_one' )
60
60
61
61
# Filter by URL
62
62
tasks = self .taskqueue_stub .get_filtered_tasks (url = '/url/of/task/1/' )
63
- assert len (tasks ) == 1
64
- assert tasks [0 ].name == 'task_one'
63
+ self . assertEqual ( len (tasks ), 1 )
64
+ self . assertEqual ( tasks [0 ].name , 'task_one' )
65
65
66
66
# Filter by queue
67
67
tasks = self .taskqueue_stub .get_filtered_tasks (queue_names = 'queue-1' )
68
- assert len (tasks ) == 1
69
- assert tasks [0 ].name == 'task_one'
68
+ self . assertEqual ( len (tasks ), 1 )
69
+ self . assertEqual ( tasks [0 ].name , 'task_one' )
70
70
71
71
# Multiple queues
72
72
tasks = self .taskqueue_stub .get_filtered_tasks (
73
73
queue_names = ['queue-1' , 'queue-2' ])
74
- assert len (tasks ) == 2
74
+ self . assertEqual ( len (tasks ), 2 )
75
75
# [END filtering]
76
76
77
77
# [START deferred]
78
78
def testTaskAddedByDeferred (self ):
79
79
deferred .defer (operator .add , 1 , 2 )
80
80
81
81
tasks = self .taskqueue_stub .get_filtered_tasks ()
82
- assert len (tasks ) == 1
82
+ self . assertEqual ( len (tasks ), 1 )
83
83
84
84
result = deferred .run (tasks [0 ].payload )
85
- assert result == 3
85
+ self . assertEqual ( result , 3 )
86
86
# [END deferred]
87
87
88
88
if __name__ == '__main__' :
0 commit comments