updated notes in map_reduce_advanced queryset test
This commit is contained in:
parent
9be6c41af7
commit
a4c5fa57e0
@ -505,8 +505,8 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
Song.drop_collection()
|
Song.drop_collection()
|
||||||
|
|
||||||
def test_map_reduce_finalize(self):
|
def test_map_reduce_finalize(self):
|
||||||
"""Ensure scope and finalize are working correctly by simulating
|
"""Ensure finalize is running by simulating "hotness"
|
||||||
"hotness" ranking with Reddit algorithm.
|
ranking with Reddit algorithm.
|
||||||
"""
|
"""
|
||||||
from time import mktime
|
from time import mktime
|
||||||
|
|
||||||
@ -521,7 +521,8 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
|
|
||||||
# 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.
|
# Fri, 12 Feb 2010 14:36:00 -0600. Link ordering should
|
||||||
|
# reflect order of insertion below.
|
||||||
|
|
||||||
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,
|
||||||
@ -588,12 +589,10 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
|
|
||||||
finalize_f = """
|
finalize_f = """
|
||||||
function(key, value) {
|
function(key, value) {
|
||||||
|
|
||||||
// f(sec_since_epoch,y,z) = log10(z) + ((y*sec_since_epoch) / 45000)
|
// f(sec_since_epoch,y,z) = log10(z) + ((y*sec_since_epoch) / 45000)
|
||||||
z_10 = Math.log(value.z) / Math.log(10);
|
z_10 = Math.log(value.z) / Math.log(10);
|
||||||
weight = z_10 + ((value.y * value.t_s) / 45000);
|
weight = z_10 + ((value.y * value.t_s) / 45000);
|
||||||
return weight;
|
return weight;
|
||||||
|
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user