Compare commits

...

No commits in common. "1aa5b5a7a4514a3e6604a9d71b001f5877b77555" and "180e53210b506856509f8203c7f9e8d5e6e76e1a" have entirely different histories.

2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"""Reusable gates that wrap a command handler.
These are the mechanisms salvaged from the unmerged vote and rate-limit
branches, detached from the NSFW command they were originally written for.
branches, detached from the command they were originally written for.
They only decide whether a handler may run; recording a successful use is the
dispatcher's job, so stacking two gates cannot double-count one invocation.
"""

View File

@ -74,10 +74,10 @@ def test_uses_today_is_per_user_and_command(store: Store) -> None:
def test_votes_are_deduplicated_per_person(store: Store) -> None:
store.add_vote(GROUP, "traps", "u1", 100.0)
store.add_vote(GROUP, "traps", "u1", 101.0)
store.add_vote(GROUP, "traps", "u2", 102.0)
assert store.count_votes(GROUP, "traps", 0.0) == 2
store.add_vote(GROUP, "kot", "u1", 100.0)
store.add_vote(GROUP, "kot", "u1", 101.0)
store.add_vote(GROUP, "kot", "u2", 102.0)
assert store.count_votes(GROUP, "kot", 0.0) == 2
def test_votes_outside_the_window_are_ignored(store: Store) -> None: