-
Notifications
You must be signed in to change notification settings - Fork 16
DPNLPF-1299: sdk_answer now returns synced random values #214
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) | ||
|
||
|
There was a problem hiding this comment.
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 из бабла и ананлогично со вторым
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так вроде сейчас тесты так и работают. not_expect_arr
же для этого добавил
bubble и pronounceText (и др.) теперь рандомятся синхронно, если количество не совпадает, то берется остаток от деления