dream
43 строки · 1.7 Кб
1import allure
2import pytest
3import requests
4
5
6@allure.description("""Knowledge grounding multi-language test""")
7@pytest.mark.parametrize(
8"checked_sentence, knowledge, text, expected",
9[
10(
11"When Mabel visited their home to play the piano, "
12"she occasionally glimpsed a flitting swirl of white in the next room, "
13"sometimes even received a note of thanks for calling, but she never actually "
14"spoke with the reclusive, almost spectral Emily.",
15"The real-life soap opera behind the publication of Emily Dickinson’s poems\n"
16"When Mabel visited their home to play the piano, she occasionally glimpsed "
17"a flitting swirl of white in the next room, sometimes even received a note of "
18"thanks for calling, but she never actually spoke with the reclusive, almost spectral Emily.",
19"Yeah she was an icon she died in 1886 at the tender age of 55.",
20True,
21),
22(
23"Penguins are a group of aquatic flightless birds.",
24"Penguins are a group of aquatic flightless birds.",
25"Who are penguins?",
26True,
27),
28],
29)
30def test_knowledge_grounding(url: str, checked_sentence, knowledge, text, expected):
31history = (
32"Do you know who Emily Dickson is?\n"
33'Emily Dickinson? The poet? I do! "Tell all the truth, but tell it slant" '
34"she once said. Do you like her poetry?"
35)
36
37request_data = {
38"batch": [
39{"checked_sentence": checked_sentence, "knowledge": knowledge, "text": text, "history": history},
40]
41}
42results = requests.post(url, json=request_data).json()
43assert all(results)
44