fix(parser): clarify free-form inspection input
This commit is contained in:
1 parent
c0a6f6286e
commit
32bb5ae3d0
5 files changed
+78
-19
No files matched your search
+11
-1
@@ -185,10 +185,17 @@ class ReportTests(unittest.TestCase):
|
||||
self.assertNotIn("Скриншот", text)
|
||||
self.assertNotIn("истории", text)
|
||||
|
||||
def test_coaching_report_uses_plural_for_multiple_kittens(self):
|
||||
session = CoachingSession(
|
||||
"15.08", "ЛУ", "11:00", "11:20", "Белка", 1, "Первый", 2,
|
||||
extra_kittens=(("Второй", 3, "самостоятельно"),),
|
||||
)
|
||||
self.assertIn("помог(-ла) котятам прокачать ЛУ: Первый [2], Второй [3].", render_coaching(session, calculate_coaching(session)))
|
||||
|
||||
def test_training_report_is_separate(self):
|
||||
text = render_training(TrainingSession("Белка", 1, "Котёнок", 2))
|
||||
self.assertIn("#урок", text)
|
||||
self.assertIn("провел(-ла) урок", text)
|
||||
self.assertIn("провёл(-ла) урок", text)
|
||||
|
||||
def test_inspection_report_lists_zero_and_resources(self):
|
||||
text = render_inspection(
|
||||
@@ -207,6 +214,9 @@ class ReportTests(unittest.TestCase):
|
||||
self.assertNotIn("Скриншот", text)
|
||||
self.assertIn("Баллы осмотра: 15 баллов.", text)
|
||||
|
||||
def test_inspection_report_explains_an_empty_resource_list(self):
|
||||
self.assertIn("Ресурсов не найдено.", render_inspection(InspectionReport("Белка", 1, "дупло", 1)))
|
||||
|
||||
def test_spider_and_web_have_different_values(self):
|
||||
report = InspectionReport(
|
||||
character_name="Дикая Вишня", character_id=1604614, place="дупло", inspections=4,
|
||||
|
||||
@@ -254,6 +254,18 @@ class VkConversationTests(unittest.TestCase):
|
||||
self.assertEqual(inspected["fields"]["character_id"], 1617140)
|
||||
self.assertIn("имени", " ".join(inspected["questions"]).lower())
|
||||
|
||||
def test_natural_inspection_does_not_confuse_date_or_id_with_count(self):
|
||||
inspected = inspect_bulk_text(
|
||||
"24.08 осмотр расщелина: 6 раз; персонаж Серолап id 1 617 140; +2 паутина, +1 паук"
|
||||
)
|
||||
self.assertEqual(inspected["fields"]["inspections"], 6)
|
||||
self.assertEqual((inspected["fields"]["character_name"], inspected["fields"]["character_id"]), ("Серолап", 1617140))
|
||||
self.assertEqual(inspected["fields"]["resources"], [["паутина", 2], ["паук", 1]])
|
||||
|
||||
def test_natural_inspection_accepts_legacy_resource_assignments_without_count_noise(self):
|
||||
inspected = inspect_bulk_text("осмотр дупло 6 раз Серолап [1617140]; паутина=2, паук: 1")
|
||||
self.assertEqual(inspected["fields"]["resources"], [["паутина", 2], ["паук", 1]])
|
||||
|
||||
def test_identity_directory_persists_pairs_in_sqlite(self):
|
||||
with TemporaryDirectory() as directory:
|
||||
path = f"{directory}/identities.sqlite3"
|
||||
|
||||
Reference in new issue
Block a user