Fixed regex.
This commit is contained in:
@ -1,16 +1,26 @@
|
||||
from typing import Union
|
||||
|
||||
import pytest
|
||||
|
||||
from lenochka.brain.brain_cell import BrainCell
|
||||
|
||||
|
||||
def test_replies() -> None:
|
||||
@pytest.mark.parametrize(
|
||||
("sentence", "expected_reply"),
|
||||
[
|
||||
("Удав", "Пиздав."),
|
||||
("Дакимакура", "Пиздакимакура."),
|
||||
("Никак нет", None),
|
||||
("нет", "Пидора ответ."),
|
||||
("Уважаемая, Леночка", "Какая я тебе нахуй Леночка, хуесос?"),
|
||||
("Леночка, принесите кофе", "Какая я тебе нахуй Леночка, хуесос?"),
|
||||
("Да нет Леночка", "Какая я тебе нахуй Леночка, хуесос?"),
|
||||
],
|
||||
)
|
||||
def test_replies(sentence: str, expected_reply: Union[str, None]) -> None:
|
||||
"""Test reply generator."""
|
||||
cell = BrainCell()
|
||||
assert cell.create_reply("Удав") == "Пиздав."
|
||||
assert cell.create_reply("Дакимакура") == "Пиздакимакура."
|
||||
|
||||
assert cell.create_reply("Никак нет") is None
|
||||
assert cell.create_reply("нет") == "Пидора ответ."
|
||||
|
||||
assert cell.create_reply("Уважаемая, Леночка") == "Какая я тебе нахуй Леночка, хуесос?"
|
||||
assert cell.create_reply("Леночка, принесите кофе") == "Какая я тебе нахуй Леночка, хуесос?"
|
||||
|
||||
assert cell.create_reply("Да нет Леночка") == "Какая я тебе нахуй Леночка, хуесос?"
|
||||
if expected_reply:
|
||||
assert cell.create_reply(sentence) == expected_reply
|
||||
else:
|
||||
assert cell.create_reply(sentence) is None
|
||||
|
||||
@ -18,6 +18,6 @@ def talk_to_the_wind() -> None:
|
||||
ears = ConnectionToEars(brain_connection)
|
||||
ears.register_message_handler(
|
||||
brain.think,
|
||||
regexp="да",
|
||||
regexp="(да|нет|леночка)",
|
||||
)
|
||||
world.start_polling(ears)
|
||||
|
||||
@ -3,6 +3,9 @@ nameOverride: "lenochka"
|
||||
image:
|
||||
tag: "latest"
|
||||
|
||||
updateStrategy:
|
||||
type: Recreate
|
||||
|
||||
service:
|
||||
enabled: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user