Skip to content

Commit

Permalink
Merge pull request #128 from Soulter/118-feature-add-unit-test
Browse files Browse the repository at this point in the history
Improve unit testing
  • Loading branch information
Soulter authored Oct 20, 2023
2 parents 2cfcb51 + 4102856 commit 4fe6ff9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

logging.basicConfig(level=logging.DEBUG)

EMAIL = os.environ.get("EMAIL")
PASSWORD = os.environ.get("PASSWORD")
EMAIL = "[email protected]"
PASSWORD = "FOR_TEST_DO_NOT_LOGIN_a1"

chatbot: hugchat.ChatBot = None
my_conversation: hugchat.conversation = None
Expand Down Expand Up @@ -52,14 +52,14 @@ def test_chat_web_search(self):
"""
test chat module with web search
"""
res = str(chatbot.chat("What's the weather like in London today?", web_search=True))
res = str(chatbot.chat("What's the weather like in London today? Reply length limited within 20 words.", web_search=True))
assert res is not None

def test_generator(self):
"""
test generator module
"""
res = chatbot.chat("What's the weather like in London today?", web_search=True, _stream_yield_all=True)
res = chatbot.chat("Just reply me `test_ok`", _stream_yield_all=True)
for i in res:
print(i, flush=True)

Expand All @@ -69,5 +69,4 @@ def test_generator(self):
test = TestAPI()
test.test_login()
test.test_create_conversation()
test.test_chat_without_web_search()
test.test_chat_web_search()
test.test_generator()

0 comments on commit 4fe6ff9

Please sign in to comment.