New math fixes, again
This commit is contained in:
1 parent
92605e7a4d
commit
ec5a1a197a
5 files changed
+130
-62
No files matched your search
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from app.belki.identity import Identity, IdentityDirectory
|
||||
from app.belki.vk_bot import HELP_TEXT, BelkiDialog, inspect_bulk_text
|
||||
from app.belki.vk_bot import HELP_TEXT, BelkiDialog, inspect_bulk_text, parse_text_command
|
||||
|
||||
|
||||
class VkConversationTests(unittest.TestCase):
|
||||
@@ -62,6 +62,14 @@ class VkConversationTests(unittest.TestCase):
|
||||
self.assertIn("Котёнок 2: Малыш [123456]", dialog._confirmation(dialog._states[80]))
|
||||
self.assertIn("самостоятель", response.lower())
|
||||
|
||||
def test_multiple_kittens_reject_mixed_independence_status(self):
|
||||
dialog = BelkiDialog()
|
||||
dialog.handle(81, "/лу")
|
||||
for answer in ("15.08", "11:00", "12:00", "Дикая Вишня [1604614]"):
|
||||
dialog.handle(81, answer)
|
||||
response = dialog.handle(81, "Беззубик [1] самостоятельно, Малыш [2] несамостоятельно")
|
||||
self.assertIn("Все котята", response)
|
||||
|
||||
def test_bulk_input_is_detected_and_confirmed(self):
|
||||
dialog = BelkiDialog()
|
||||
confirmation = dialog.handle(
|
||||
@@ -255,6 +263,20 @@ class VkConversationTests(unittest.TestCase):
|
||||
dialog.handle(502, answer)
|
||||
self.assertIn("скриншот", dialog.handle(502, "несам").lower())
|
||||
|
||||
def test_compact_command_accepts_all_independence_variants(self):
|
||||
for value, expected in (
|
||||
("сам", "самостоятельно"),
|
||||
("самостоятельный", "самостоятельно"),
|
||||
("самостоятельно", "самостоятельно"),
|
||||
("несам", "несамостоятельно"),
|
||||
("несамостоятельный", "несамостоятельно"),
|
||||
("несамостоятельно", "несамостоятельно"),
|
||||
):
|
||||
parsed = parse_text_command(
|
||||
f"/зу 16.08 10:00 10:10 | Белка [1] | Малыш [2] | {value}"
|
||||
)
|
||||
self.assertEqual(parsed["kitten_independence"], expected)
|
||||
|
||||
def test_keyboard_changes_with_dialog_state(self):
|
||||
dialog = BelkiDialog()
|
||||
menu = dialog.keyboard_for(503)
|
||||
|
||||
Reference in new issue
Block a user