1+ import logging
12import unittest
23
4+ import pytest
5+
36from llmwhisperer .client import LLMWhispererClient
47
8+ logger = logging .getLogger (__name__ )
59
6- class TestLLMWhispererClient (unittest .TestCase ):
7- @unittest .skip ("Skipping test_get_usage_info" )
8- def test_get_usage_info (self ):
9- client = LLMWhispererClient ()
10- usage_info = client .get_usage_info ()
11- print (usage_info )
12- self .assertIsInstance (usage_info , dict )
1310
11+ @pytest .fixture
12+ def llm_whisperer_client ():
13+ # Create an instance of the client
14+ client = LLMWhispererClient ()
15+ return client
16+
17+
18+ def test_get_usage_info (llm_whisperer_client ):
19+ usage_info = llm_whisperer_client .get_usage_info ()
20+ logger .info (usage_info )
21+ assert isinstance (usage_info , dict ), "usage_info should be a dictionary"
22+ expected_keys = [
23+ "current_page_count" ,
24+ "daily_quota" ,
25+ "monthly_quota" ,
26+ "overage_page_count" ,
27+ "subscription_plan" ,
28+ "today_page_count" ,
29+ ]
30+ assert set (usage_info .keys ()) == set (expected_keys ), f"usage_info { usage_info } does not contain the expected keys"
31+
32+
33+ class TestLLMWhispererClient (unittest .TestCase ):
1434 @unittest .skip ("Skipping test_whisper" )
1535 def test_whisper (self ):
1636 client = LLMWhispererClient ()
@@ -22,30 +42,31 @@ def test_whisper(self):
2242 timeout = 200 ,
2343 store_metadata_for_highlighting = True ,
2444 )
25- print (response )
45+ logger . info (response )
2646 # self.assertIsInstance(response, dict)
2747
2848 @unittest .skip ("Skipping test_whisper_status" )
2949 def test_whisper_status (self ):
3050 client = LLMWhispererClient ()
3151 response = client .whisper_status (whisper_hash = "7cfa5cbb|5f1d285a7cf18d203de7af1a1abb0a3a" )
32- print (response )
52+ logger . info (response )
3353 self .assertIsInstance (response , dict )
3454
3555 @unittest .skip ("Skipping test_whisper_retrieve" )
3656 def test_whisper_retrieve (self ):
3757 client = LLMWhispererClient ()
3858 response = client .whisper_retrieve (whisper_hash = "7cfa5cbb|5f1d285a7cf18d203de7af1a1abb0a3a" )
39- print (response )
59+ logger . info (response )
4060 self .assertIsInstance (response , dict )
4161
62+ @unittest .skip ("Skipping test_whisper_highlight_data" )
4263 def test_whisper_highlight_data (self ):
4364 client = LLMWhispererClient ()
4465 response = client .highlight_data (
4566 whisper_hash = "9924d865|5f1d285a7cf18d203de7af1a1abb0a3a" ,
4667 search_text = "Indiranagar" ,
4768 )
48- print (response )
69+ logger . info (response )
4970 self .assertIsInstance (response , dict )
5071
5172
0 commit comments