From 2fe36d513a0f6937eed092a344bea95a80b994c9 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Sun, 16 Aug 2026 22:49:09 +0300 Subject: [PATCH] math fixes --- app/belki/domain.py | 2 +- tests/test_api.py | 2 +- tests/test_belki.py | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/belki/domain.py b/app/belki/domain.py index 9c6c308..a710cc9 100644 --- a/app/belki/domain.py +++ b/app/belki/domain.py @@ -181,7 +181,7 @@ def _inspection_resource_value(name: str) -> int: or SequenceMatcher(None, letters, "змея").ratio() >= 0.8 ): return 0 - if "паутин" in letters or "паутн" in letters or normalized == "паук": + if "паутин" in letters or "паутн" in letters: return 7 if "обычн" in normalized and "мох" in normalized: return 3 diff --git a/tests/test_api.py b/tests/test_api.py index 5e17a51..bf26fb9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -41,7 +41,7 @@ class ApiTests(unittest.TestCase): } ) self.assertIn("осмотрел(-а) дупло 6 раз", response["message"]) - self.assertEqual(response["result"]["points"], 21) + self.assertEqual(response["result"]["points"], 15) def test_bulk_inspection_payload_explains_missing_fields(self): response = inspect_bulk_payload({"text": "/лу 15.08 11:00 11:20 | Белка [1] | Котёнок [2]"}) diff --git a/tests/test_belki.py b/tests/test_belki.py index 25735b5..6f5b9e6 100644 --- a/tests/test_belki.py +++ b/tests/test_belki.py @@ -159,7 +159,14 @@ class ReportTests(unittest.TestCase): self.assertIn("+2 вьюнок.", text) self.assertIn("+1 паук.", text) self.assertNotIn("Скриншот", text) - self.assertIn("Баллы осмотра: 21 баллы.", text) + self.assertIn("Баллы осмотра: 15 баллы.", text) + + def test_spider_and_web_have_different_values(self): + report = InspectionReport( + character_name="Дикая Вишня", character_id=1604614, place="дупло", inspections=4, + resources=(("вьюнок", 1), ("паутина", 1), ("паук", 2)), + ) + self.assertEqual(calculate_inspection(report).points, 18) def test_inspection_points_include_attempts_and_resource_values(self): report = InspectionReport(