feat: Add IPv4 and IPv6 address validation utilities with comprehensive test coverage - #7066
Closed
tboy1337 wants to merge 3 commits into
Closed
feat: Add IPv4 and IPv6 address validation utilities with comprehensive test coverage#7066tboy1337 wants to merge 3 commits into
tboy1337 wants to merge 3 commits into
Conversation
- Introduced new functions for validating and comparing IPv4 and IPv6 addresses. - Enhanced `address_in_network` to support both IPv4 and IPv6 checks. - Added tests for new functionalities, including edge cases for CIDR notation and invalid inputs. - Updated `requirements-dev.txt` to include additional testing dependencies: pytest-mock, pytest-timeout, and pytest-xdist.
Member
|
There is already an open PR for this in #5953. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR possibly solves #5953 by introducing robust IPv4 and IPv6 address validation utilities to the requests library, enhancing the existing
address_in_networkfunction to support both IPv4 and IPv6 CIDR notation checks.Changes
New Functionality
address_in_networkfunction to support both IPv4 and IPv6 addresses with CIDR notationTesting
Files Changed
src/requests/utils.py: +113 insertionstests/test_utils.py: +191 insertionsTotal: 2 files changed, 263 insertions(+), 41 deletions(-)
Testing
All new functionality has been thoroughly tested with comprehensive unit tests covering both happy paths and edge cases. The test suite ensures robust handling of various IP address formats and network configurations.
Motivation
This enhancement improves the library's ability to handle modern networking scenarios where both IPv4 and IPv6 addresses are commonly used, providing developers with reliable tools for address validation and network comparisons.