feat: localize tags and genres; improve search, duration and sorting
CI / test (push) Successful in 27s
CI / test (push) Successful in 27s
This commit is contained in:
1 parent
ea3074e0a9
commit
be4fbf6864
31 files changed
+1126
-145
No files matched your search
@@ -172,6 +172,17 @@ class RecommendTests(RecoFixture):
|
||||
allowed_statuses={"backlog", "playing", "played"})
|
||||
self.assertIn("Delta", self.names(results))
|
||||
|
||||
def test_localized_tags_in_output(self):
|
||||
self.con.execute("UPDATE tag_names SET name_ru=? WHERE name=?", ("Ролевая игра", "RPG"))
|
||||
self.con.commit()
|
||||
mood, results = reco.recommend(self.con, self.mood(), limit=10)
|
||||
self.assertIn("Ролевая игра", mood["tags"])
|
||||
self.assertIn("Ролевые игры", mood["genres"])
|
||||
alpha = next(g for g in results if g["appid"] == 1)
|
||||
self.assertIn("Ролевая игра", alpha["matched"])
|
||||
self.assertIn("Ролевые игры", alpha["genres"])
|
||||
self.assertTrue(any("Ролевая игра" in reason for reason in alpha["reasons"]))
|
||||
|
||||
def test_unplayed_only(self):
|
||||
_, results = reco.recommend(self.con, self.mood(), unplayed_only=True)
|
||||
self.assertEqual(set(self.names(results)), {"Alpha", "Beta", "Gamma", "NoTags"})
|
||||
@@ -331,6 +342,13 @@ class SimilarGamesTests(RecoFixture):
|
||||
ids = [g["appid"] for g in reco.similar_games(self.con, 3)]
|
||||
self.assertEqual(ids, [])
|
||||
|
||||
def test_similar_games_localizes_matched_tags(self):
|
||||
self.con.execute("UPDATE tag_names SET name_ru=? WHERE name=?", ("Ролевая игра", "RPG"))
|
||||
self.con.commit()
|
||||
results = reco.similar_games(self.con, 1, limit=6)
|
||||
self.assertIn("Ролевая игра", results[0]["matched"])
|
||||
self.assertIn("Ролевые игры", results[0]["genres"])
|
||||
|
||||
def test_unknown_or_untagged_game(self):
|
||||
self.assertEqual(reco.similar_games(self.con, 999), [])
|
||||
self.assertEqual(reco.similar_games(self.con, 8), [])
|
||||
|
||||
Reference in new issue
Block a user