-
-
Notifications
You must be signed in to change notification settings - Fork 45.4k
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
Improve our test coverage #9943
Open
Labels
Comments
tianyizheng02
added
enhancement
This PR modified some existing files
help wanted
good first issue
labels
Oct 6, 2023
14 tasks
14 tasks
This was referenced Oct 7, 2023
14 tasks
This was referenced Oct 7, 2023
I'll work on the palindrome script |
Hi. I am new and would like to contribute to this issue |
14 tasks
This was referenced Oct 9, 2023
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Yes, this issue is still open. @DhanushA1307 @mustalidhanerawala We don't assign issues in this repo. If you want to work on it, just open a PR with your changes. Our contributing guidelines already say this, so read those first if you haven't already. |
15 tasks
15 tasks
15 tasks
lorduke22
added a commit
to lorduke22/Python
that referenced
this issue
Oct 5, 2024
15 tasks
Any new progress? |
AnanthaKrishnan63
added a commit
to AnanthaKrishnan63/Python
that referenced
this issue
Oct 6, 2024
15 tasks
AnanthaKrishnan63
added a commit
to AnanthaKrishnan63/Python
that referenced
this issue
Oct 6, 2024
added doctest
AnanthaKrishnan63
added a commit
to AnanthaKrishnan63/Python
that referenced
this issue
Oct 6, 2024
contributes to TheAlgorithms#9943
15 tasks
15 tasks
15 tasks
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
MelihMSahin
added a commit
to MelihMSahin/Python
that referenced
this issue
Oct 14, 2024
Contributes to TheAlgorithms#9943 by adding doctests, including negative numbers and an array of same integers.
15 tasks
MelihMSahin
added a commit
to MelihMSahin/Python
that referenced
this issue
Oct 14, 2024
Addeded doctest in the if __name__. Checks for negaitves and an array of same integers
This comment was marked as off-topic.
This comment was marked as off-topic.
shikhar-sm
added a commit
to shikhar-sm/Python
that referenced
this issue
Oct 18, 2024
shikhar-sm
added a commit
to shikhar-sm/Python
that referenced
this issue
Oct 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Feature description
Many of our existing algorithm files have little to no unit testing. This is problematic because this can easily let bugs slip through. We want some assurance that the code we currently have is correct and functional. We welcome all contributors to open PRs to help us add tests to our codebase.
How to find low-coverage files
Go to the Actions tab in this repository and find the most recent build workflow run. Open the logs under "Run Tests" and scroll down until you find the section on code coverage:
The "Cover" column tells you what percentage of the lines in that file are covered by tests. We want to increase this percentage for existing files. Find a file with low coverage percentage that you wish to write tests for, add doctests for each function, and open a PR with your changes. You do not need to have a perfect coverage percentage, but all functions should have doctests.
Some files will naturally be hard to write tests for. For example, the file may be poorly written because they lack any functions. Other files might be how-tos, meaning they simply demonstrate how to use an existing library's functions rather than implementing the algorithm themselves. Ignore these kinds of files, as they will need to be rewritten eventually. Furthermore, ignore files in the
web_programming
andproject_euler
directories. Web programming files are inherently hard to test and Project Euler files have their own validation workflow, so don't worry about their test coverage.When you open your PR, put "Contributes to #9943" in the PR description. Do not use the word "fixes", "resolves", or "closes". This issue is an ongoing one, and your PR will not single-handedly resolve this issue.
How to add doctests
A doctest is a unit test that is contained within the documentation comment (docstring) for a function. Here is an example of what doctests look like within a docstring:
For every function in the file you choose, you should write doctests like the ones shown above in its docstring. If a function doesn't have a docstring, add one. Your doctests should be comprehensive but not excessive: you should write just enough tests to cover all basic cases as well as all edge cases (e.g., negative numbers, empty lists, etc).
Do not simply run a function on some example inputs and put its output as the expected output for a doctest. This assumes that the function is implemented correctly when it might not be. Verify independently that your doctests and their expected outputs are correct. Your PR will not be merged if it has failing tests. If you happen to discover a bug while writing doctests, please fix it.
Please read our contributing guidelines before you contribute.
The text was updated successfully, but these errors were encountered: