Skip to content

Refactoring Ip.py to return proper boolean values#1043

Merged
securestep9 merged 5 commits intoOWASP:masterfrom
pUrGe12:ip-tests
May 27, 2025
Merged

Refactoring Ip.py to return proper boolean values#1043
securestep9 merged 5 commits intoOWASP:masterfrom
pUrGe12:ip-tests

Conversation

@pUrGe12
Copy link
Contributor

@pUrGe12 pUrGe12 commented Mar 11, 2025

Proposed change

Currently the ip.py file has functions that are return boolean values to determine valid IP addresses. In functions like is_ipv4_range, its using and with netaddr.IPNetwork() which returns an IPNetwork object and not a boolean. This hasn't affected any functionality because its always being used as if is_ipv4_range(ip) which results in true as long as the function doesn't return False, but for tests it will be necessary.

Type of change

  • New core framework functionality
  • Bugfix (non-breaking change which fixes an issue)
  • Code refactoring without any functionality changes
  • New or existing module/payload change
  • Localization improvement
  • Dependency upgrade
  • Documentation improvement

Checklist

  • I've followed the contributing guidelines
  • I've run make pre-commit, it didn't generate any changes
  • I've run make test, all tests passed locally

@pUrGe12 pUrGe12 changed the title Ip tests Created tests for Ip.py Mar 11, 2025
@securestep9
Copy link
Collaborator

securestep9 commented Mar 19, 2025

please don't mix the tests with core functionality refactoring in one PR.

@pUrGe12
Copy link
Contributor Author

pUrGe12 commented Mar 19, 2025

I'll keep this one only to refactoring the ip.py file to make it suitable for the tests.

@pUrGe12 pUrGe12 changed the title Created tests for Ip.py Refactoring Ip.py to return proper boolean values Mar 19, 2025
@securestep9 securestep9 added this pull request to the merge queue May 27, 2025
Merged via the queue into OWASP:master with commit 10c9551 May 27, 2025
17 checks passed
pUrGe12 added a commit to pUrGe12/Nettacker that referenced this pull request Jun 3, 2025
* added bool to netaddr instances, removed redundant imports

* created test file for ip.py

* refactoring ip.py
pUrGe12 added a commit to pUrGe12/Nettacker that referenced this pull request Jun 9, 2025
* added bool to netaddr instances, removed redundant imports

* created test file for ip.py

* refactoring ip.py
pUrGe12 added a commit to pUrGe12/Nettacker that referenced this pull request Jun 10, 2025
* added bool to netaddr instances, removed redundant imports

* created test file for ip.py

* refactoring ip.py
pUrGe12 added a commit to pUrGe12/Nettacker that referenced this pull request Jun 12, 2025
* added bool to netaddr instances, removed redundant imports

* created test file for ip.py

* refactoring ip.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants