Spaces:
Paused
Paused
Update intent_test_runner.py
Browse files- intent_test_runner.py +16 -14
intent_test_runner.py
CHANGED
|
@@ -56,38 +56,40 @@ def run_all_tests():
|
|
| 56 |
|
| 57 |
headers = {"X-Session-ID": session_id}
|
| 58 |
|
| 59 |
-
# Fallback testi
|
| 60 |
-
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "
|
| 61 |
assert_test("LLM fallback", r.json(), "")
|
| 62 |
|
| 63 |
-
# Döviz kuru testi
|
| 64 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "döviz kuru nedir"}, headers=headers)
|
| 65 |
assert_test("Eksik parametre — currency", r.json(), "Lütfen currency")
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
|
|
|
|
| 70 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yenidolar kuru nedir"}, headers=headers)
|
| 71 |
-
assert_test("Geçersiz parametre — currency", r.json(), "
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "hava nasıl"}, headers=headers)
|
| 75 |
-
assert_test("Konu değişikliği sonrası fallback", r.json(), "")
|
| 76 |
-
|
| 77 |
-
# Yol durumu testi (eksik from_location)
|
| 78 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yol durumu"}, headers=headers)
|
| 79 |
assert_test("Eksik parametre — from_location", r.json(), "Lütfen from_location")
|
| 80 |
|
| 81 |
-
#
|
| 82 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[0]}, headers=headers)
|
| 83 |
assert_test("Eksik parametre — to_location", r.json(), "Lütfen to_location")
|
| 84 |
|
| 85 |
-
#
|
| 86 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[1]}, headers=headers)
|
| 87 |
assert_test("Parametre tamamlandı — yol durumu", r.json(), "trafik açık")
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
summarize_tests()
|
| 90 |
|
| 91 |
except Exception as e:
|
| 92 |
log(f"❌ run_all_tests sırasında hata oluştu: {e}")
|
| 93 |
-
|
|
|
|
| 56 |
|
| 57 |
headers = {"X-Session-ID": session_id}
|
| 58 |
|
| 59 |
+
# ✅ Fallback testi: alakasız cümle
|
| 60 |
+
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "Mars'a bilet alabilir miyim?"}, headers=headers)
|
| 61 |
assert_test("LLM fallback", r.json(), "")
|
| 62 |
|
| 63 |
+
# ✅ Döviz kuru testi: eksik parametre
|
| 64 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "döviz kuru nedir"}, headers=headers)
|
| 65 |
assert_test("Eksik parametre — currency", r.json(), "Lütfen currency")
|
| 66 |
|
| 67 |
+
# ✅ Döviz kuru testi: geçerli parametre
|
| 68 |
+
valid_currency = currency_options[0] # örn: dolar
|
| 69 |
+
r = requests.post(f"{BASE_URL}/chat", json={"user_input": valid_currency}, headers=headers)
|
| 70 |
+
assert_test("Parametre tamamlandı — dolar", r.json(), f"{valid_currency} kuru şu an")
|
| 71 |
|
| 72 |
+
# ✅ Döviz kuru testi: geçersiz parametre
|
| 73 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yenidolar kuru nedir"}, headers=headers)
|
| 74 |
+
assert_test("Geçersiz parametre — currency", r.json(), "Geçerli bir döviz cinsi")
|
| 75 |
|
| 76 |
+
# ✅ Yol durumu testi: eksik from_location
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yol durumu"}, headers=headers)
|
| 78 |
assert_test("Eksik parametre — from_location", r.json(), "Lütfen from_location")
|
| 79 |
|
| 80 |
+
# ✅ Yol durumu testi: from_location tamamlandı
|
| 81 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[0]}, headers=headers)
|
| 82 |
assert_test("Eksik parametre — to_location", r.json(), "Lütfen to_location")
|
| 83 |
|
| 84 |
+
# ✅ Yol durumu testi: to_location tamamlandı
|
| 85 |
r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[1]}, headers=headers)
|
| 86 |
assert_test("Parametre tamamlandı — yol durumu", r.json(), "trafik açık")
|
| 87 |
|
| 88 |
+
# ✅ Hava durumu fallback testi: eksik city parametresi
|
| 89 |
+
r = requests.post(f"{BASE_URL}/chat", json={"user_input": "hava durumu"}, headers=headers)
|
| 90 |
+
assert_test("Eksik parametre — city", r.json(), "Lütfen city")
|
| 91 |
+
|
| 92 |
summarize_tests()
|
| 93 |
|
| 94 |
except Exception as e:
|
| 95 |
log(f"❌ run_all_tests sırasında hata oluştu: {e}")
|
|
|