touched up comments in advanced map/reduce test
This commit is contained in:
parent
f4d0938e3d
commit
f47d926f29
@ -696,8 +696,8 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
|
|
||||||
# Note: Test data taken from a custom Reddit homepage on
|
# Note: Test data taken from a custom Reddit homepage on
|
||||||
# Fri, 12 Feb 2010 14:36:00 -0600. Link ordering should
|
# Fri, 12 Feb 2010 14:36:00 -0600. Link ordering should
|
||||||
# reflect order of insertion below.
|
# reflect order of insertion below, but is not influenced
|
||||||
|
# by insertion order.
|
||||||
Link(title = "Google Buzz auto-followed a woman's abusive ex ...",
|
Link(title = "Google Buzz auto-followed a woman's abusive ex ...",
|
||||||
up_votes = 1079,
|
up_votes = 1079,
|
||||||
down_votes = 553,
|
down_votes = 553,
|
||||||
@ -768,10 +768,14 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# provide the reddit epoch (used for ranking) as a variable available
|
||||||
|
# to all phases of the map/reduce operation: map, reduce, and finalize.
|
||||||
reddit_epoch = mktime(datetime(2005, 12, 8, 7, 46, 43).timetuple())
|
reddit_epoch = mktime(datetime(2005, 12, 8, 7, 46, 43).timetuple())
|
||||||
scope = {'reddit_epoch': reddit_epoch}
|
scope = {'reddit_epoch': reddit_epoch}
|
||||||
|
|
||||||
# ensure both artists are found
|
# run a map/reduce operation across all links. ordering is set
|
||||||
|
# to "-value", which orders the "weight" value returned from
|
||||||
|
# "finalize_f" in descending order.
|
||||||
results = Link.objects.order_by("-value")
|
results = Link.objects.order_by("-value")
|
||||||
results = results.map_reduce(map_f,
|
results = results.map_reduce(map_f,
|
||||||
reduce_f,
|
reduce_f,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user