Skip to content

test: add unit tests for zep_paging module#564

Open
JiayuuWang wants to merge 3 commits into
666ghj:mainfrom
JiayuuWang:contribot/test-zep-paging
Open

test: add unit tests for zep_paging module#564
JiayuuWang wants to merge 3 commits into
666ghj:mainfrom
JiayuuWang:contribot/test-zep-paging

Conversation

@JiayuuWang
Copy link
Copy Markdown

Summary

  • Add comprehensive unit tests for backend/app/utils/zep_paging.py
  • Tests cover fetch_all_nodes and fetch_all_edges functions

Test Coverage

  • TestFetchPageWithRetry: success on first attempt, retry on transient errors, exhausting retries, max_retries parameter
  • TestFetchAllNodes: empty graph, single page return, multi-page pagination with uuid_cursor, max_items limit enforcement, missing uuid field handling, page_size parameter
  • TestFetchAllEdges: empty graph, single page return, multi-page pagination, page_size handling, missing uuid field handling

Test Plan

  • Run python -m pytest tests/test_zep_paging.py -v - all 15 tests pass

🤖 Generated with Claude Code

MiroFish Contributor and others added 3 commits April 21, 2026 00:02
When the LLM generates a <tool_call> block followed by a self-generated
<tool_result> block in the same response, the fake result must be stripped
before appending to message history. The real tool result will be injected
separately by the system.

This fixes a React Hallucination bug where models could fabricate tool
results that didn't actually come from tool invocations.
- Added pytest.ini configuration for test discovery
- Added tests/__init__.py package marker
- Added 22 unit tests covering:
  - _read_text_with_fallback: UTF-8, GBK, Latin-1, replacement chars
  - FileParser: extensions, nonexistent file, unsupported format, md/txt extraction
  - FileParser.extract_from_multiple: valid files and error handling
  - split_text_into_chunks: short text, empty text, chunk size, overlap, sentence boundaries

All tests pass with direct module import to avoid Flask initialization issues.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add comprehensive tests for fetch_all_nodes and fetch_all_edges functions:
- Test success on first attempt
- Test retry behavior on transient errors
- Test max_retries exhaustion
- Test pagination with uuid_cursor
- Test max_items limit enforcement
- Test missing uuid field handling
- Test page_size parameter

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant