dream

Форк
0
33 строки · 944.0 Байт
1
import requests
2
import json
3

4

5
def get_input_json(fname):
6
    with open(fname, "r") as f:
7
        res = json.load(f)
8
    return {"dialogs": [res]}
9

10

11
def test_one_step_responses():
12
    url = "http://0.0.0.0:8085/respond"
13

14
    print("test annotations")
15
    input_data = get_input_json("test_configs/test_annotations.json")
16
    for t in range(10):
17
        response = requests.post(url, json=input_data).json()[0]
18
        if any([response[0][i] for i in range(len(response[0]))]):
19
            print(f"success in try {t}")
20
            break
21
        if t == 9:
22
            assert any([response[0][i] for i in range(len(response[0]))]), print(response)
23

24
    print("test no annotations")
25
    input_data = get_input_json("test_configs/test_no_annotations.json")
26
    response = requests.post(url, json=input_data).json()[0]
27
    assert response[0][0] == "", print(response)
28

29
    print("SUCCESS!")
30

31

32
if __name__ == "__main__":
33
    test_one_step_responses()
34

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.