ciyidogan commited on
Commit
3fbf837
·
verified ·
1 Parent(s): 4a33397

Update intent_test_runner.py

Browse files
Files changed (1) hide show
  1. intent_test_runner.py +9 -12
intent_test_runner.py CHANGED
@@ -56,39 +56,36 @@ def run_all_tests():
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:
 
56
 
57
  headers = {"X-Session-ID": session_id}
58
 
59
+ # ✅ Fallback testi: hiçbir intent'e eşleşmeyen
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
 
 
 
 
64
  valid_currency = currency_options[0] # örn: dolar
65
+ r = requests.post(f"{BASE_URL}/chat", json={"user_input": f"{valid_currency} kuru nedir"}, headers=headers)
66
  assert_test("Parametre tamamlandı — dolar", r.json(), f"{valid_currency} kuru şu an")
67
 
68
+ # ✅ Geçersiz currency testi
69
  r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yenidolar kuru nedir"}, headers=headers)
70
  assert_test("Geçersiz parametre — currency", r.json(), "Geçerli bir döviz cinsi")
71
 
72
+ # ✅ Yol durumu zinciri
73
  r = requests.post(f"{BASE_URL}/chat", json={"user_input": "yol durumu"}, headers=headers)
74
  assert_test("Eksik parametre — from_location", r.json(), "Lütfen from_location")
75
 
 
76
  r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[0]}, headers=headers)
77
  assert_test("Eksik parametre — to_location", r.json(), "Lütfen to_location")
78
 
 
79
  r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[1]}, headers=headers)
80
  assert_test("Parametre tamamlandı — yol durumu", r.json(), "trafik açık")
81
 
82
+ # ✅ Hava durumu zinciri
83
  r = requests.post(f"{BASE_URL}/chat", json={"user_input": "hava durumu"}, headers=headers)
84
  assert_test("Eksik parametre — city", r.json(), "Lütfen city")
85
 
86
+ r = requests.post(f"{BASE_URL}/chat", json={"user_input": city_options[0]}, headers=headers)
87
+ assert_test("Parametre tamamlandı — hava durumu", r.json(), f"{city_options[0]} için hava güneşli")
88
+
89
  summarize_tests()
90
 
91
  except Exception as e: