test: a watch's weight by age, and each contrast test under its reason
`draw.recency` weighs every watch of both affinities: an undated watch and a future one now have a test (deleting either branch fails it). The over-the-picture contrast test moves below the form-on-chrome test, so each sits under the comment that explains it.
This commit is contained in:
@@ -42,6 +42,20 @@ def test_a_short_side_is_topped_up_from_the_other():
|
||||
assert draw.blend(["a", "b", "c"], [], 0, 3) == ["a", "b", "c"]
|
||||
|
||||
|
||||
def test_a_watch_weighs_by_its_age_an_undated_one_two_half_lives_and_a_future_one_now():
|
||||
# Both affinities weigh every watch through this one rule; an old import has no date, and a
|
||||
# clock ahead of the server's must not weigh more than a watch made now.
|
||||
assert draw.recency(NOW, NOW, 30) == 1.0
|
||||
assert draw.recency(NOW - timedelta(days=30), NOW, 30) == 0.5
|
||||
assert draw.recency(None, NOW, 30) == 0.25
|
||||
assert draw.recency(NOW + timedelta(days=5), NOW, 30) == 1.0
|
||||
|
||||
|
||||
def test_scores_are_scaled_to_the_strongest_and_nothing_scored_is_empty():
|
||||
assert draw.scaled({"a": 4.0, "b": 1.0}) == {"a": 1.0, "b": 0.25}
|
||||
assert draw.scaled({}) == {}
|
||||
|
||||
|
||||
# ── YouTube: the channels the user watches ───────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user