Repository navigation
R35-T036: Simplify one responsibility in connection (insta_down.py) - #66
Closed
suraj-3010 wants to merge 1 commit into
Closed
suraj-3010 wants to merge 1 commit into
suraj-3010 wants to merge 1 commit into
Conversation
4 tasks
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.
Description
This PR refactors
connectioninInstaDownloader/insta_down.pyby extracting the network reachability check and exception categorization into a dedicated subroutinecheck_url_reachability, separating network probing from terminal output while strictly preserving the public function signature and behavior.Related Issue
Fixes: #36
Type of Change
Changes Made
connectionintocheck_url_reachability(url, timeout)returning(is_connected, message).connection(url='http://www.google.com/', timeout=5)contract and stdout printing behavior.if __name__ == '__main__':and added safe import handling forinstaloader.InstaDownloader/test_insta_down.pyvalidating smallest valid input, ordinary input, and error response paths with mocked requests.work/R35-T036/check.pyrunner andwork/R35-T036/evidence.md.Screenshots / Recordings
There is no UI change.
Testing
python3 work/R35-T036/check.py: PASS (all checks, smallest input, ordinary input, and 4 unittest cases passed).FORCE_WRONG=1 python3 work/R35-T036/check.py: FAIL (exited with code 1 upon deliberate value mismatch).python3 -m unittest "InstaDownloader/test_insta_down.py": PASS (4 tests ran in 0.001s, OK).Checklist
Additional Notes
Evidence and check artifacts are recorded under
work/R35-T036/.