Skip to content

Commit

Permalink
Merge pull request #8 from Sibbear1980/branch_vasiliy
Browse files Browse the repository at this point in the history
new test added
  • Loading branch information
VasiliVorobev authored Mar 12, 2024
2 parents e9b4fbd + 6e190c8 commit 4311513
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,55 @@

client = TestClient(app)


# тест 1
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Hello World"}


# тест 2
def test_predict_positive():
response = client.post("/predict/", json={"text": "I love you!"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "позитивный :)"


# тест 3
def test_predict_negative():
response = client.post("/predict/", json={"text": "I am very angry"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "негативный (("


# тест 4
def test_predict_russian_positive():
response = client.post("/predict/", json={"text": "Я люблю учиться"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "позитивный :)"


# тест 5
def test_predict_russian_negative():
response = client.post("/predict/", json={"text": "Я ненавижу тебя"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "негативный (("

# тест 6
def test_predict_russian_neutral():
response = client.post("/predict/", json={"text": "Сегодня наступила весна"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "нейтральный"

# тест 7
def test_predict_neutral():
response = client.post("/predict/", json={"text": "Today spring has come"})
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "нейтральный"





0 comments on commit 4311513

Please sign in to comment.