From 1dd1205a8fc52fa2d99e504be5d512a662653e82 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:03:23 +0000 Subject: [PATCH 1/3] Add test for name2uniprot HTTPError handling Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> --- tests/test_pathwaycommons.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_pathwaycommons.py diff --git a/tests/test_pathwaycommons.py b/tests/test_pathwaycommons.py new file mode 100644 index 00000000..6501fb93 --- /dev/null +++ b/tests/test_pathwaycommons.py @@ -0,0 +1,22 @@ +import urllib.request +import urllib.error +from unittest.mock import patch +from bionetgen.atomizer.utils.pathwaycommons import name2uniprot + +def test_name2uniprot_organism_httperror(): + with patch('urllib.request.urlopen') as mock_urlopen: + # Create an HTTPError instance + # HTTPError requires url, code, msg, hdrs, fp + mock_urlopen.side_effect = urllib.error.HTTPError( + url="http://www.uniprot.org/uniprot/?", + code=500, + msg="Internal Server Error", + hdrs={}, + fp=None + ) + + # Call the function with an organism to hit the target try/except block + result = name2uniprot("TestGene", ["http://identifiers.org/taxonomy/9606"]) + + # The function should catch the HTTPError and return None + assert result is None From ba5f06f442659161fbda07c52e0312606a74554b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:15:44 +0000 Subject: [PATCH 2/3] Add test for name2uniprot HTTPError handling Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> --- tests/test_pathwaycommons.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_pathwaycommons.py b/tests/test_pathwaycommons.py index 6501fb93..ae7d3bfd 100644 --- a/tests/test_pathwaycommons.py +++ b/tests/test_pathwaycommons.py @@ -3,8 +3,9 @@ from unittest.mock import patch from bionetgen.atomizer.utils.pathwaycommons import name2uniprot + def test_name2uniprot_organism_httperror(): - with patch('urllib.request.urlopen') as mock_urlopen: + with patch("urllib.request.urlopen") as mock_urlopen: # Create an HTTPError instance # HTTPError requires url, code, msg, hdrs, fp mock_urlopen.side_effect = urllib.error.HTTPError( @@ -12,7 +13,7 @@ def test_name2uniprot_organism_httperror(): code=500, msg="Internal Server Error", hdrs={}, - fp=None + fp=None, ) # Call the function with an organism to hit the target try/except block From 1d9296427b7e4886dbd895e32777e02e4e6a919c Mon Sep 17 00:00:00 2001 From: akutuva21 Date: Mon, 13 Apr 2026 10:16:25 -0400 Subject: [PATCH 3/3] chore: PR #60 remove forbidden artifacts and run black --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 39aa9026..f9bf9c80 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ temp_testing/* build dist Issues/rule_keywords/test_DeleteMolecules_changed.bngl +.jules/ +__pycache__/