test: add initial test infrastructure with 21 unit tests for utility functions#105
Open
ayazhankadessova wants to merge 1 commit intosugarlabs:mainfrom
Open
Conversation
Sugar-AI currently has no tests. This adds the first test suite covering pure utility functions that do not require model loading or GPU access: - extract_answer_from_output: 10 tests (edge cases, markers, fallback) - format_docs: 3 tests (single, multiple, empty) - combine_messages: 2 tests (string, non-string) - _extract_after_prompt: 6 tests (prompt removal, EOS trimming, double-newline truncation with length threshold) All 21 tests pass. Run with: python -m pytest tests/ -v
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sugar-AI currently has no test infrastructure. This PR adds the first test suite covering pure utility functions that do not require model loading or GPU access.
What's Added
tests/__init__.py— makes tests a Python packagetests/test_utils.py— 21 tests across 4 function groups:extract_answer_from_outputformat_docscombine_messagesRAGAgent._extract_after_promptWhy These Functions
These are pure utility functions with no side effects — they don't need a model loaded, GPU access, or network calls. This makes the tests fast (~4 seconds) and runnable on any contributor's machine.
Running
All 21 tests pass:
AI Disclosure
This PR was developed with AI assistance (Claude Code). All tests were manually verified against the actual function behavior before submission.