Skip to content

[Sweep Rules] Add Unit Tests for New Business Logic#19

Open
sweep-ai-deprecated[bot] wants to merge 3 commits into
masterfrom
sweep/add-unit-tests-for-new-business-logic
Open

[Sweep Rules] Add Unit Tests for New Business Logic#19
sweep-ai-deprecated[bot] wants to merge 3 commits into
masterfrom
sweep/add-unit-tests-for-new-business-logic

Conversation

@sweep-ai-deprecated

Copy link
Copy Markdown
Contributor

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

I created this PR to address this rule:

"All new business logic should have corresponding unit tests in the same directory. For example, tests/utils/string_test.py tests aicord/utils/string.py. We use pytest for tests."

Description

This PR adds unit tests for the new business logic introduced in the files aicord/core/ai/summarize.py and tests/test_example.py. The unit tests are added in the same directory as the source files, following the project's convention.

Summary

  • Added unit tests for the functions and components in aicord/core/ai/summarize.py in the file tests/core/ai/test_summarize.py.
  • Added unit tests for the function in tests/test_example.py in the file tests/test_example_test.py.
  • The unit tests cover the initialization of the ChatOpenAI, OpenAIEmbeddings, and CharacterTextSplitter objects, as well as the load_summarize_chain function in aicord/core/ai/summarize.py.
  • The tests also ensure that the test_addition function in tests/test_example.py correctly raises an AssertionError when 1 + 1 does not equal 2.

@sweep-ai-deprecated

Copy link
Copy Markdown
Contributor Author

Rollback Files For Sweep

  • Rollback changes to tests/core/ai/test_summarize.py
  • Rollback changes to tests/test_example_test.py
  • Rollback changes to tests/test_example_test.py

@sweep-ai-deprecated

Copy link
Copy Markdown
Contributor Author

Sandbox Executions

  • Check tests/core/ai/test_summarize.py
Sandbox logs for
trunk fmt tests/core/ai/test_summarize.py || exit 0 1/2 ✓
 ✔ Formatted tests/core/ai/test_summarize.py
Re-checking autofixed files...

 ✔ Formatted tests/core/ai/test_summarize.py
Re-checking autofixed files...


Checked 1 file
✔ No issues
Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/core/ai/test_summarize.py 2/2 ❌ (`1`)
 ✔ Auto-fixed tests/core/ai/test_summarize.py
Re-checking autofixed files...


  ISSUES  
tests/core/ai/test_summarize.py:18:0
 18:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 19:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 20:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 26:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 33:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 48:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 49:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 50:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
 51:0  low  Use of assert detected. The enclosed code will be removed when compiling to optimised byte       bandit/B101
            code.                                                                                                       
Checked 1 file
✖ 9 new issues
  • Check tests/test_example_test.py
Sandbox logs for https://github.com/mptylabs/aicord/commit/83260fa9dce82483757f3fdbc383c201c3c9d49a
trunk fmt tests/test_example_test.py || exit 0 1/2 ✓
 ✔ Formatted tests/test_example_test.py
Re-checking autofixed files...


Checked 1 file
✔ No issues
Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_example_test.py 2/2 ✓
Checked 1 file
✔ No issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant