Skip to content

DPNLPF-1299: sdk_answer now returns synced random values #214

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bart02
Copy link
Collaborator

@bart02 bart02 commented Mar 5, 2022

bubble и pronounceText (и др.) теперь рандомятся синхронно, если количество не совпадает, то берется остаток от деления

SyrexMinus
SyrexMinus previously approved these changes Mar 15, 2022
Copy link
Collaborator

@SyrexMinus SyrexMinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я потестил на аппе. Ответы всегда синхронны, если одинаковое количество ответов и в pronounce_text и bubble. Если количество ответов разное, то синхронизация работает не всегда. Но это предусмотрено остатком от деления, так что функционал корректен.

for i in range(10):
action = SDKAnswer(items)
result = action.run(user, None)
self.assertEqual("ANSWER_TO_USER", result[0].name)
self.assertTrue(str(result[0].raw) in expect_arr)
self.assertFalse(str(result[0].raw) in not_expect_arr)


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавить сюда еще один метод теста "test_sync_random":
на вход:
{
"pronounceText": ["pronounceText1", "pronounceText2"],
"items": [
{
"bubble": {
"text": ["Text1", "Text2"]
}
},
...
}}

если выбрался pronounceText1 - то должен выбраться Text1 из бабла и ананлогично со вторым

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так вроде сейчас тесты так и работают. not_expect_arr же для этого добавил

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants