Commit b032668
Run example unit tests on CI (#65)
Run example unit tests on CI
This pull request includes several changes to the test suite and minor
code improvements. The most important changes include adding new test
cases, updating existing test cases to handle edge cases, and improving
logging for better debugging.
### Test Suite Enhancements:
*
[`.github/workflows/python-tests.yml`](diffhunk://#diff-207f09dfa0bc604a684631a1c78be7d9aa00f9a6c778eec30afa287990be3da1R41-R55):
Added steps to run unit tests for examples and specific tests for
example 1.
*
`examples/team_recommender/tests/example_1_text_response/test_compute_cosine_similarity.py`:
- Marked `test_reproducing_the_same_text_embedding` as expected to fail
due to snapshot mismatch.
- Updated `test_cosine_similarity_generated_responses` to use a relative
tolerance in the assertion.
- Adjusted tolerance levels in `test_embedding_equivalence` to better
reflect expected values.
*
[`examples/team_recommender/tests/example_1_text_response/test_good_fit_for_project.py`](diffhunk://#diff-db487fce77691c75d0084c3052d3e7dac4b1c16e5cc5b77c2d6a7e517a6f539aL115-R124):
Updated `test_llm_will_hallucinate_given_no_data` to include an
assertion for embedding length and improve stability.
[[1]](diffhunk://#diff-db487fce77691c75d0084c3052d3e7dac4b1c16e5cc5b77c2d6a7e517a6f539aL115-R124)
[[2]](diffhunk://#diff-db487fce77691c75d0084c3052d3e7dac4b1c16e5cc5b77c2d6a7e517a6f539aR137)
### Code Improvements:
*
[`examples/team_recommender/tests/example_1_text_response/openai_embeddings.py`](diffhunk://#diff-7e124963dbad8becc0d3cf8af970ffcdb8d3a15f08ec530ac66648503fe787c1L42-R42):
Added type annotations to the `create_embedding_object` function.
*
[`examples/team_recommender/tests/helpers.py`](diffhunk://#diff-b54fa0ba78b35d1e06f5b7ca59c90ca4a88ce1676c58e0dc9f9e89f915b31dbaR87-R91):
Replaced `print` statements with `logger.info` for better logging and
debugging.
[[1]](diffhunk://#diff-b54fa0ba78b35d1e06f5b7ca59c90ca4a88ce1676c58e0dc9f9e89f915b31dbaR87-R91)
[[2]](diffhunk://#diff-b54fa0ba78b35d1e06f5b7ca59c90ca4a88ce1676c58e0dc9f9e89f915b31dbaL97-R111)
*
[`examples/team_recommender/tests/example_3_loop/test_allocations_loop.py`](diffhunk://#diff-a4c3d4f6f1052fc7c10a3a00e82a7d0c06a2192edcb5507fbe3409b9613dd072L46-R49):
Reformatted a long assertion message for better readability.
### Minor Changes:
*
[`examples/team_recommender/tests/helpers.py`](diffhunk://#diff-b54fa0ba78b35d1e06f5b7ca59c90ca4a88ce1676c58e0dc9f9e89f915b31dbaR2):
Imported the `logging` module.
*
[`tests/test_statistical_analysis.py`](diffhunk://#diff-1b63b741bad5a1599ef03397d53a764337af1e7591c991d4a28fba6e9665a1b1L26-R26):
Reformatted parameterized test cases for consistency.
[[1]](diffhunk://#diff-1b63b741bad5a1599ef03397d53a764337af1e7591c991d4a28fba6e9665a1b1L26-R26)
[[2]](diffhunk://#diff-1b63b741bad5a1599ef03397d53a764337af1e7591c991d4a28fba6e9665a1b1L123-R120)
---------
Signed-off-by: Paul Zabelin <paulzabelin@artium.ai>
Co-authored-by: Paul Zabelin <59230+paulz@users.noreply.github.com>
Co-authored-by: Paul Zabelin <paulz@users.noreply.github.com>1 parent 635e55e commit b032668
File tree
12 files changed
+12356
-6174
lines changed- .github/workflows
- examples/team_recommender/tests
- example_1_text_response
- snapshots
- test_compute_cosine_similarity/test_reproducing_the_same_text_embedding
- test_good_fit_for_project/test_llm_will_hallucinate_given_no_data
- example_3_loop
- fixtures
- tests
12 files changed
+12356
-6174
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
41 | 56 | | |
42 | 57 | | |
43 | 58 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments