Title: R23-T042: Property test octal-to-hexadecimal conversion by pruthvirajgojare-source · Pull Request #84 · S-AI-Projects/TheAlgorithms-Python · GitHub
Open Graph Title: R23-T042: Property test octal-to-hexadecimal conversion by pruthvirajgojare-source · Pull Request #84 · S-AI-Projects/TheAlgorithms-Python
X Title: R23-T042: Property test octal-to-hexadecimal conversion by pruthvirajgojare-source · Pull Request #84 · S-AI-Projects/TheAlgorithms-Python
Description: Description Fix a bug in an existing algorithm. Hypothesis found that converting octal zero returned 0x instead of the reference value 0x0. The converter now returns the correct zero representation. Related Issue S-AI-Projects/TheAlgorithms-Python#43 Fixes: #43 Type of Change Bug Fix New Feature UI/UX Improvement Performance Improvement Tests Documentation Refactoring / Maintenance CI/CD Changes Made Added a Hypothesis property test with 2,000 examples for valid octal strings, including optional 0o prefixes and leading zeros, compared against hex(int(s, 8)) in the converter's uppercase output format. Added a 2,000-example property checking that inputs containing invalid octal digits 8 or 9 raise ValueError. Fixed zero conversion to return 0x0 and added doctests for zero, leading zeros, the 0o prefix, and invalid digits. Recorded the properties and minimal counterexample ("0") in work/R23-T042/PROPERTIES.md. Screenshots / Recordings Not applicable; this change does not affect a user interface. Testing uv run --with hypothesis --with pytest python -m pytest work/R23-T042/ -q — passed; 2 property tests, 2,000 examples each. uv run --group test python -m pytest conversions -q — passed; 82 tests. uv run --group test python -m doctest -v conversions/octal_to_hexadecimal.py — passed; all 10 doctests. uvx ruff check conversions/octal_to_hexadecimal.py and uvx ruff check --ignore INP001 work/R23-T042/test_octal_to_hexadecimal_properties.py — passed. uv run --with hypothesis pytest work/R23-T042/ — did not collect because Hypothesis was unavailable to the environment's pytest launcher. Supplying both dependencies and running pytest as a module (first command above) passed. uv run --with hypothesis --group test python -m pytest -q — blocked during collection: scripts/validate_filenames.py rejects the required uppercase/hyphenated work/R23-T042/ evidence path. That validator was left unchanged to keep the code change scoped. Checklist I have tested my changes locally. I have added or updated tests, if needed. I have updated documentation, if needed. I have followed the project's coding guidelines. I have run the relevant tests and checks. I have addressed previous review feedback, if applicable. (No previous review feedback.) Additional Notes The code-only branch upstream/R23-T042 is prepared for a future upstream change; no upstream PR was opened.
Open Graph Description: Description Fix a bug in an existing algorithm. Hypothesis found that converting octal zero returned 0x instead of the reference value 0x0. The converter now returns the correct zero representati...
X Description: Description Fix a bug in an existing algorithm. Hypothesis found that converting octal zero returned 0x instead of the reference value 0x0. The converter now returns the correct zero representati...
Opengraph URL: https://github.com/S-AI-Projects/TheAlgorithms-Python/pull/84
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0098d677-8925-e930-44ef-e01ba2f2fa91 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8FA0:16CE4E:F486F:159F54:6AFDF873 |
| html-safe-nonce | 4cee35284a82cf50f1ae0967285958cb146346c58b7ad5812e7e16f627ac629e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkEwOjE2Q0U0RTpGNDg2RjoxNTlGNTQ6NkFGREY4NzMiLCJ2aXNpdG9yX2lkIjoiMzk1MjQyNTA2MzAyNTYwNDcyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d7ab5fa5d9c94ee30ee4e974999f3dcf1efa9155b90c293ae4cf4b532b26da26 |
| hovercard-subject-tag | pull_request:5354574493 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/S-AI-Projects/TheAlgorithms-Python/pull/84/files |
| twitter:image | https://avatars.githubusercontent.com/u/295325153?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/295325153?s=400&v=4 |
| og:image:alt | Description Fix a bug in an existing algorithm. Hypothesis found that converting octal zero returned 0x instead of the reference value 0x0. The converter now returns the correct zero representati... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee3343385a977757dd145b28fabf4a119780f2615a5a36c5a89f66c9b3b5616d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/S-AI-Projects/TheAlgorithms-Python git https://github.com/S-AI-Projects/TheAlgorithms-Python.git |
| octolytics-dimension-user_id | 351892385 |
| octolytics-dimension-user_login | S-AI-Projects |
| octolytics-dimension-repository_id | 1444141022 |
| octolytics-dimension-repository_nwo | S-AI-Projects/TheAlgorithms-Python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 63476337 |
| octolytics-dimension-repository_parent_nwo | TheAlgorithms/Python |
| octolytics-dimension-repository_network_root_id | 63476337 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/Python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 43ae91995f6e2d5ff7a491f3de438f1f723adeaa |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width