René's URL Explorer Experiment


Title: Improve our test coverage · Issue #9943 · TheAlgorithms/Python · GitHub

Open Graph Title: Improve our test coverage · Issue #9943 · TheAlgorithms/Python

X Title: Improve our test coverage · Issue #9943 · TheAlgorithms/Python

Description: 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....

Open Graph Description: 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 c...

X Description: 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 c...

Opengraph URL: https://github.com/TheAlgorithms/Python/issues/9943

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve our test coverage","articleBody":"### Feature description\r\n\r\nMany 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.\r\n\r\n### How to find low-coverage files\r\n\r\nGo 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:\r\n```\r\n---------- coverage: platform linux, python 3.12.0-final-0 -----------\r\nName                                                                          Stmts   Miss  Cover   Missing\r\n-----------------------------------------------------------------------------------------------------------\r\nquantum/q_fourier_transform.py                                                   30     30     0%   14-93\r\nscripts/validate_solutions.py                                                    54     54     0%   2-94\r\nstrings/min_cost_string_conversion.py                                            78     75     4%   20-57, 61-75, 79-129\r\n...\r\n```\r\nThe \"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.\r\n\r\nSome 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` and `project_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.\r\n\r\n_**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.\r\n\r\n### How to add doctests\r\n\r\nA 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:\r\n```py\r\ndef add(a: int, b: int) -\u003e int:\r\n    \"\"\"\r\n    Adds two non-negative numbers.\r\n    \u003e\u003e\u003e add(1, 1)\r\n    2\r\n    \u003e\u003e\u003e add(2, 5)\r\n    7\r\n    \u003e\u003e\u003e add(1, 0)\r\n    1\r\n    \u003e\u003e\u003e add(-1, -1)\r\n    Traceback (most recent last):\r\n    ...\r\n    ValueError: Numbers must be non-negative\r\n    \"\"\"\r\n```\r\nFor 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).\r\n\r\nDo 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.\r\n\r\n_**Please read our [contributing guidelines](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md) before you contribute.**_","author":{"url":"https://github.com/tianyizheng02","@type":"Person","name":"tianyizheng02"},"datePublished":"2023-10-06T20:04:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":54},"url":"https://github.com/9943/Python/issues/9943"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:83d1d6e3-2d73-d84a-907a-fea2792f9073
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEBEC:1A5A05:132E628:191407E:6A5C53FB
html-safe-noncebea6fe631622b4d69d8e9deced1513112f3caadbfb9cf69c434ef286421d7d19
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkVDOjFBNUEwNToxMzJFNjI4OjE5MTQwN0U6NkE1QzUzRkIiLCJ2aXNpdG9yX2lkIjoiMzY5NjMzNjAyNzM3ODI3NTMyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac36795e715dd2659b05eb9933c6ad6119ed95173ccf7ec0c7e74e857edd6e4945
hovercard-subject-tagissue:1930869192
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TheAlgorithms/Python/9943/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1b46706386d9cd0e919ce7402448b7c534711e8e4bd6017f3404602c00210b95/TheAlgorithms/Python/issues/9943
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1b46706386d9cd0e919ce7402448b7c534711e8e4bd6017f3404602c00210b95/TheAlgorithms/Python/issues/9943
og:image:altFeature 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 c...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametianyizheng02
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
go-importgithub.com/TheAlgorithms/Python git https://github.com/TheAlgorithms/Python.git
octolytics-dimension-user_id20487725
octolytics-dimension-user_loginTheAlgorithms
octolytics-dimension-repository_id63476337
octolytics-dimension-repository_nwoTheAlgorithms/Python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id63476337
octolytics-dimension-repository_network_root_nwoTheAlgorithms/Python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/TheAlgorithms/Python/issues/9943#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FPython%2Fissues%2F9943
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FPython%2Fissues%2F9943
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TheAlgorithms%2FPython
Reloadhttps://github.com/TheAlgorithms/Python/issues/9943
Reloadhttps://github.com/TheAlgorithms/Python/issues/9943
Reloadhttps://github.com/TheAlgorithms/Python/issues/9943
Please reload this pagehttps://github.com/TheAlgorithms/Python/issues/9943
TheAlgorithms https://github.com/TheAlgorithms
Pythonhttps://github.com/TheAlgorithms/Python
Please reload this pagehttps://github.com/TheAlgorithms/Python/issues/9943
Notifications https://github.com/login?return_to=%2FTheAlgorithms%2FPython
Fork 50.9k https://github.com/login?return_to=%2FTheAlgorithms%2FPython
Star 223k https://github.com/login?return_to=%2FTheAlgorithms%2FPython
Code https://github.com/TheAlgorithms/Python
Issues 141 https://github.com/TheAlgorithms/Python/issues
Pull requests 875 https://github.com/TheAlgorithms/Python/pulls
Discussions https://github.com/TheAlgorithms/Python/discussions
Actions https://github.com/TheAlgorithms/Python/actions
Projects https://github.com/TheAlgorithms/Python/projects
Wiki https://github.com/TheAlgorithms/Python/wiki
Security and quality 0 https://github.com/TheAlgorithms/Python/security
Insights https://github.com/TheAlgorithms/Python/pulse
Code https://github.com/TheAlgorithms/Python
Issues https://github.com/TheAlgorithms/Python/issues
Pull requests https://github.com/TheAlgorithms/Python/pulls
Discussions https://github.com/TheAlgorithms/Python/discussions
Actions https://github.com/TheAlgorithms/Python/actions
Projects https://github.com/TheAlgorithms/Python/projects
Wiki https://github.com/TheAlgorithms/Python/wiki
Security and quality https://github.com/TheAlgorithms/Python/security
Insights https://github.com/TheAlgorithms/Python/pulse
Improve our test coveragehttps://github.com/TheAlgorithms/Python/issues/9943#top
#10822https://github.com/TheAlgorithms/Python/pull/10822
enhancementThis PR modified some existing fileshttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22enhancement%22
good first issuehttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22good%20first%20issue%22
help wantedhttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/tianyizheng02
tianyizheng02https://github.com/tianyizheng02
on Oct 6, 2023https://github.com/TheAlgorithms/Python/issues/9943#issue-1930869192
#9943https://github.com/TheAlgorithms/Python/issues/9943
contributing guidelineshttps://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md
enhancementThis PR modified some existing fileshttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22enhancement%22
good first issuehttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22good%20first%20issue%22
help wantedhttps://github.com/TheAlgorithms/Python/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.