Mel Seto commited on
Commit
0544d13
·
unverified ·
2 Parent(s): 73d6bd0 439044b

Merge pull request #4 from mel-seto/remove-test_retriever

Browse files

Remove remaining references of retriever module to fix build

Files changed (2) hide show
  1. src/app.py +0 -1
  2. tests/test_retriever.py +0 -39
src/app.py CHANGED
@@ -5,7 +5,6 @@ import gradio as gr
5
  from cerebras.cloud.sdk import Cerebras
6
  from dotenv import load_dotenv
7
 
8
- from retrieval.retriever import retrieve_idiom
9
  from utils.utils import get_pinyin
10
  from verification.verifier import verify_idiom_exists
11
 
 
5
  from cerebras.cloud.sdk import Cerebras
6
  from dotenv import load_dotenv
7
 
 
8
  from utils.utils import get_pinyin
9
  from verification.verifier import verify_idiom_exists
10
 
tests/test_retriever.py DELETED
@@ -1,39 +0,0 @@
1
- import pytest
2
- from retrieval.retriever import retrieve_idiom
3
-
4
- def test_basic_retrieval():
5
- situation = "I want to describe something that never changes."
6
- top_k = 3
7
- results = retrieve_idiom(situation, top_k=top_k)
8
-
9
- # Check type and length
10
- assert isinstance(results, list)
11
- assert len(results) == top_k
12
-
13
- # Check that each entry is a string
14
- for item in results:
15
- assert isinstance(item, str)
16
- assert len(item) > 0
17
-
18
- def test_empty_query():
19
- results = retrieve_idiom("", top_k=2)
20
- assert isinstance(results, list)
21
- assert len(results) == 2
22
- for item in results:
23
- assert isinstance(item, str)
24
- assert len(item) > 0
25
-
26
- ## TODO: fix embedding logic so that this test passes
27
- @pytest.mark.parametrize(
28
- "situation, idiom",
29
- [
30
- ("to return from a rewarding journey", "满载而归"),
31
- ("omnipresent", "无所不在"),
32
- ],
33
- )
34
- def test_definition_returns_correct_idiom(situation, idiom):
35
- """if input situation is the same as the embedded English definition,
36
- RAG implementation should return the correct Chinese idiom"""
37
- top_k_idioms = retrieve_idiom(situation, top_k=3)
38
- print(top_k_idioms)
39
- assert any(idiom in s for s in top_k_idioms)