-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for split_paragraph_chunks
function
#6
Conversation
Rollback Files For Sweep
|
Apply Sweep Rules to your PR?
|
aicord/utils/string_test.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this file to tests/utils/string_tests.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
I wasn't able to make changes. This could be due to an unclear request or a bug in my code.
As a reminder, comments on a file only modify that file. Comments on a PR (at the bottom of the "conversation" tab) can modify the entire PR. Please try again or contact us on Discord
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be stored in /tests/utils/string_tests.py
, rather then /aicord/utils/string_test.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
I wasn't able to make changes. This could be due to an unclear request or a bug in my code.
As a reminder, comments on a file only modify that file. Comments on a PR (at the bottom of the "conversation" tab) can modify the entire PR. Please try again or contact us on Discord
aicord/utils/string_test.py
Outdated
from aicord.utils.string import split_paragraph_chunks | ||
|
||
|
||
class TestSplitParagraphChunks(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write a test, where multiple paragraphs are smaller than max length, so that 2 paragraphs fit into 1 chunk, but 3rrd one doesn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
Done.
tests/utils/string_test.py
Outdated
""" | ||
Test case where multiple paragraphs are smaller than max length, so that 2 paragraphs fit into 1 chunk, but 3rd one doesn't. | ||
""" | ||
text = "This is the first paragraph. " + "This is the second paragraph.\n\n" + "This is the third paragraph." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not actually test splitting paragraphs, each paragraph is represented by \n\n
, but it is only once here. Please, double check other functions also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add GitHub action to run tests
@sweep-ai Please, add GitHub action to run tests |
🚀 Wrote ChangesDone. |
.github/workflows/test.yml
Outdated
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use exact version 3.10.13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Use exact version
3.10.13
- Make it a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Wrote Changes
Done.
PR Feedback (click)
Description
This PR adds tests for the
split_paragraph_chunks
function in theaicord/utils/string.py
file. The function is responsible for splitting a large text into smaller chunks by paragraphs, with each chunk being less than a specified maximum length. The tests ensure that the function correctly splits the text into chunks of the appropriate size and that each chunk contains the correct text.Summary of Changes
string_test.py
in theaicord/utils/
directory to house the tests for thesplit_paragraph_chunks
function.unittest
andunittest.mock
, as well as thesplit_paragraph_chunks
function fromaicord/utils/string.py
.TestSplitParagraphChunks
that inherits fromunittest.TestCase
.TestSplitParagraphChunks
class to cover various scenarios, such as text shorter than the maximum length, text exactly equal to the maximum length, text longer than the maximum length, and text with multiple paragraphs.@unittest.mock.patch
as necessary to mock any dependencies.Please review and merge this PR to ensure the correctness of the
split_paragraph_chunks
function and improve the overall test coverage of the repository.Fixes #5.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: