Skip to content

Commit

Permalink
Update test cases for topic and prompt selection
Browse files Browse the repository at this point in the history
- Rename test_select_recent_with_nested_topic to test_select_recent_with_topic_tree
- Add test case for selecting topics
- Add test case for selecting recent prompts within a nested topic
  • Loading branch information
basicthinker committed Jun 6, 2023
1 parent d96528f commit 0d53c92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_select_topics_and_prompts_with_single_root(tmp_path):
assert prompt.hash == child_hashes[2 - index]


def test_select_recent_with_nested_topic(tmp_path):
def test_select_recent_with_topic_tree(tmp_path):
config = OpenAIChatConfig(model="gpt-3.5-turbo")
chat = OpenAIChat(config)
store = Store(tmp_path / "store.graphml", chat)
Expand Down Expand Up @@ -222,6 +222,11 @@ def test_select_recent_with_nested_topic(tmp_path):
store.store_prompt(grandchild_prompt)
grandchild_hashes.append(grandchild_prompt.hash)

# Test selecting topics
topics = store.select_topics(0, 5)
assert len(topics) == 1
assert topics[0]['root_prompt'].hash == root_prompt.hash

# Test selecting recent prompts within the nested topic
recent_prompts = store.select_prompts(1, 3, topic=root_prompt.hash)
assert len(recent_prompts) == 2
Expand Down

0 comments on commit 0d53c92

Please sign in to comment.