fix: preserve independence for each kitten

This commit is contained in:
nyan404 committed 2026-08-25 21:36:03 +03:00
1 parent 7018bc0398
commit fa61d11912
8 files changed
+74 -74

No files matched your search

+16 -33
View File
@@ -67,22 +67,13 @@ class CalculationTests(unittest.TestCase):
self.assertEqual(result.kitten_points, 12)
def test_non_self_kitten_and_extra_companion(self):
with self.assertRaisesRegex(ValueError, "Для ЗУ все котята должны быть самостоятельными"):
CoachingSession(
date="15.08",
skill="ЗУ",
start="11:00",
end="12:00",
escort_name="Белка",
escort_id=1,
kitten_name="Первый",
kitten_id=2,
kitten_independence="несамостоятельно",
extra_kittens=(
("Второй", 3, "несамостоятельно"),
("Третий", 4, "самостоятельно"),
),
)
session = CoachingSession(
date="15.08", skill="ЗУ", start="11:00", end="12:00",
escort_name="Белка", escort_id=1, kitten_name="Первый", kitten_id=2,
kitten_independence="несамостоятельно",
extra_kittens=(("Второй", 3, "несамостоятельно"), ("Третий", 4, "самостоятельно")),
)
self.assertEqual(calculate_coaching(session).escort_points, 32.7)
def test_domain_rejects_excessive_coaching_and_inspection_input(self):
extras = tuple((f"Котёнок {index}", index + 2, "самостоятельно") for index in range(50))
@@ -111,19 +102,13 @@ class CalculationTests(unittest.TestCase):
extra_kittens=((None, 3, "самостоятельно"),), # type: ignore[arg-type]
)
def test_zu_rejects_non_self_kitten(self):
with self.assertRaisesRegex(ValueError, "Для ЗУ все котята должны быть самостоятельными"):
CoachingSession(
date="16.08",
skill="ЗУ",
start="13:00",
end="13:30",
escort_name="Дикая Вишня",
escort_id=1604614,
kitten_name="Муся",
kitten_id=134437,
kitten_independence="несамостоятельно",
)
def test_zu_allows_a_non_self_kitten(self):
session = CoachingSession(
date="16.08", skill="ЗУ", start="13:00", end="13:30",
escort_name="Дикая Вишня", escort_id=1604614,
kitten_name="Муся", kitten_id=134437, kitten_independence="несамостоятельно",
)
self.assertEqual(calculate_coaching(session).escort_points, 9)
def test_non_self_60_minutes_gives_adult_18_and_kitten_12(self):
result = calculate_coaching(
@@ -179,10 +164,8 @@ class CalculationTests(unittest.TestCase):
).escort_points
self.assertEqual(points("самостоятельно", "самостоятельно"), 18)
with self.assertRaisesRegex(ValueError, "Для ЗУ все котята должны быть самостоятельными"):
points("самостоятельно", "несамостоятельно")
with self.assertRaisesRegex(ValueError, "Для ЗУ все котята должны быть самостоятельными"):
points("несамостоятельно", "несамостоятельно")
self.assertEqual(points("самостоятельно", "несамостоятельно"), 24)
self.assertEqual(points("несамостоятельно", "несамостоятельно"), 30)
def test_training_is_fixed(self):
self.assertEqual(calculate_training(TrainingSession("Белка", 1, "Котёнок", 2)).points, 25)