Includes multilingual etymology fields, seed data for starter names, and CI-ready Python project layout.
21 lines
609 B
Python
21 lines
609 B
Python
"""Unit tests for Store ranking helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from stork.db import Store
|
|
|
|
|
|
def test_store_ranks_by_score_then_alpha(tmp_path: Path) -> None:
|
|
store = Store(tmp_path / "t.sqlite3")
|
|
a = store.add_name("first", "Zed", "x")
|
|
store.add_name("first", "Ann", "x")
|
|
c = store.add_name("first", "Bo", "x")
|
|
store.vote(a["id"], "v1", "A", 1)
|
|
store.vote(c["id"], "v1", "A", 1)
|
|
store.vote(c["id"], "v2", "B", 1)
|
|
ranked = store.list_names("first")
|
|
assert [n["spelling"] for n in ranked] == ["Bo", "Zed", "Ann"]
|
|
store.close()
|