File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
#
3
- # Copyright (C) 2007-2008 Christopher Lenz
3
+ # Copyright (C) 2007-2009 Christopher Lenz
4
4
# All rights reserved.
5
5
#
6
6
# This software is licensed as described in the file COPYING, which
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
#
3
- # Copyright (C) 2007 Christopher Lenz
3
+ # Copyright (C) 2007-2009 Christopher Lenz
4
4
# All rights reserved.
5
5
#
6
6
# This software is licensed as described in the file COPYING, which
@@ -200,14 +200,16 @@ def test_view_function_objects(self):
200
200
for i in range (1 , 4 ):
201
201
self .db .create ({'i' : i , 'j' :2 * i })
202
202
203
- map_fun = lambda doc : (yield doc ['i' ], doc ['j' ])
203
+ def map_fun (doc ):
204
+ yield doc ['i' ], doc ['j' ]
204
205
res = list (self .db .query (map_fun , language = 'python' ))
205
206
self .assertEqual (3 , len (res ))
206
207
for idx , i in enumerate (range (1 ,4 )):
207
208
self .assertEqual (i , res [idx ].key )
208
209
self .assertEqual (2 * i , res [idx ].value )
209
210
210
- reduce_fun = lambda keys ,values ,rereduce : sum (values )
211
+ def reduce_fun (doc ):
212
+ return sum (values )
211
213
res = list (self .db .query (map_fun , reduce_fun , 'python' ))
212
214
self .assertEqual (1 , len (res ))
213
215
self .assertEqual (12 , res [0 ].value )
You can’t perform that action at this time.
0 commit comments