Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
longbinlai committed Nov 25, 2024
1 parent 40dad31 commit 8607165
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/graphy/extractor/paper_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ def _get_section_title_info(self):
cur_page_num = int(item["page_num"])

if cur_page_num >= last_page_num and int(cur_sec) <= last_sec:
logger.warn(f"SECTION NUMBER CONFLICTS")
logger.warning(f"SECTION NUMBER CONFLICTS")
continue

section_order.append({"sec_name": "", "section_id": cur_sec})
Expand Down
5 changes: 5 additions & 0 deletions python/graphy/graph/nodes/paper_reading_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def __str__(self):
def __repr__(self) -> str:
return f"ProgressInfo [ Number: {self.number}, Completed: {self.completed} ]"

def __eq__(self, other):
if isinstance(other, ProgressInfo):
return self.completed == other.completed and self.number == other.number
return False


class ExtractNode(BaseChainNode):
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion python/graphy/memory/memory_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __init__(self) -> None:
def add_block(self, block: MemoryBlock):
block_id = block.get_block_id()
if block_id in self.blocks:
logger.warn(f"Block with id {block_id} already exists in the manager.")
logger.warning(f"Block with id {block_id} already exists in the manager.")
else:
self.blocks[block_id] = block
return block_id
Expand Down
6 changes: 6 additions & 0 deletions python/graphy/tests/workflow/paper_inspector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,11 @@ def test_inspector_execute():
assert persist_store.get_state(data_id, "Paper")
assert persist_store.get_state(data_id, "Contribution")
assert persist_store.get_state(data_id, "Challenge")
assert persist_store.get_state(data_id, "_DONE")

assert inspector.progress["Paper"] == ProgressInfo(completed=1, number=1)
assert inspector.progress["Contribution"] == ProgressInfo(completed=1, number=1)
assert inspector.progress["Challenge"] == ProgressInfo(completed=1, number=1)
assert inspector.progress["total"] == ProgressInfo(completed=3, number=3)

temp_dir.cleanup()
4 changes: 2 additions & 2 deletions python/graphy/utils/arxiv_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def find_paper_from_arxiv(self, name, max_results):

if highest_similarity > 0.9 or found_result:
break
logger.warn(f"Not Found: {query}")
logger.warning(f"Not Found: {query}")

if highest_similarity > 0.9:
break
Expand Down Expand Up @@ -164,7 +164,7 @@ def download_paper(self, name: str, max_results):

return download_list
else:
logger.warn(f"Failed to fetch paper with arxiv: {name}")
logger.warning(f"Failed to fetch paper with arxiv: {name}")
return []

def fetch_paper(self, name: str, max_results):
Expand Down

0 comments on commit 8607165

Please sign in to comment.