Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Nov 7, 2023

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.

Copy link
Contributor Author

sweep-ai bot commented Nov 7, 2023

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 sweep-ai bot added the sweep label Nov 7, 2023
Copy link
Contributor Author

sweep-ai bot commented Nov 7, 2023

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant