Skip to content

Conversation

@Sid0004
Copy link
Contributor

@Sid0004 Sid0004 commented Oct 28, 2025

Summary

This PR adds comprehensive unit tests for the torbot.modules.linktree module as requested in issue #300.

Changes

  • ✅ Added 18 tests for LinkTree and LinkNode classes
    • Tree building with depth limits
    • Duplicate URL handling
    • File I/O (JSON and text output)
    • Contact extraction (emails, phone numbers)
    • HTTP status code handling
  • ✅ Added 11 edge-case tests for parsing helpers
    • parse_hostname(), parse_links(), parse_emails(), parse_phone_numbers()
    • Empty inputs, invalid data, malformed URLs
  • ✅ Added test infrastructure
    • tests/conftest.py - test-time shim for NLP classifier (avoids numpy dependency in tests)
    • run_tests.py - helper script for running tests without package installation

Coverage

All tests pass (29/29). This PR covers:

  • ✅ Parsing edge cases (empty inputs, invalid formats, duplicates)
  • ✅ Tree construction and navigation
  • ✅ Depth-limited recursion
  • ✅ Contact extraction integration
  • ✅ File persistence (JSON and text)
  • ✅ Error handling for malformed data

Fixes #300

Test Results

image

@Sid0004
Copy link
Contributor Author

Sid0004 commented Oct 28, 2025

Hi maintainers! 👋

I've added comprehensive unit tests for the linktree module as requested in #300. All 29 tests pass locally.

Quick summary:

  • 18 tests for LinkTree/LinkNode (tree building, depth limits, duplicates, file I/O)
  • 11 edge-case tests for parsing helpers
  • Added test infrastructure to run without heavy ML dependencies

Happy to make any changes if needed. Thanks for reviewing!

@KingAkeem
Copy link
Member

pytest build failed

@KingAkeem KingAkeem self-requested a review October 29, 2025 00:04
@KingAkeem KingAkeem added Unit test Hacktoberfest HackToberFest 2025 Python Pull requests that update Python code Enhancement labels Oct 29, 2025
@Sid0004
Copy link
Contributor Author

Sid0004 commented Oct 29, 2025

Changes: Removed the errant line that was causing NameError: name 'LinkTree' is not defined
image

@Sid0004
Copy link
Contributor Author

Sid0004 commented Oct 29, 2025

! I wanted to kindly ask if you could please add the hacktoberfest-accepted label to my pull request in this repo .
I really appreciate your time and the opportunity to contribute — thank you again for reviewing my work!

Copy link
Member

@KingAkeem KingAkeem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM and runs successfully, great work

@KingAkeem KingAkeem merged commit 6df64d0 into DedSecInside:dev Oct 29, 2025
2 checks passed
@Sid0004
Copy link
Contributor Author

Sid0004 commented Oct 29, 2025

Could you please mark this PR as “hacktoberfest-accepted” so it counts toward the event? Thank you!

@Sid0004
Copy link
Contributor Author

Sid0004 commented Oct 29, 2025

Thank you again for merging my PR! Really appreciate your time and support.

@KingAkeem
Copy link
Member

You're welcome and will do, thank you for the contribution. Feel free to tackle anything else that you'd like.

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

Labels

Enhancement Hacktoberfest HackToberFest 2025 hacktoberfest-accepted Python Pull requests that update Python code Unit test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help Us Enhance Tests!

2 participants