add tests for bad url and http error

This commit is contained in:
lee-t
2025-05-18 21:47:02 -04:00
committed by Peter Cock
parent 41fa46f50e
commit ebcc56b389

View File

@ -159,6 +159,20 @@ class TestPDBListGetStructure(unittest.TestCase):
str(context.exception),
)
def test_retrieve_pdb_file_not_existing(self):
"""Tests retrieving a non-existent molecule returns None."""
with self.make_temp_directory(os.getcwd()) as tmp:
pdblist = PDBList(pdb=tmp)
result = pdblist.retrieve_pdb_file("zzzz", file_format="pdb")
self.assertIsNone(result)
def test_retrieve_pdb_file_bad_url(self):
"""Tests retrieving with bad server URL returns None."""
with self.make_temp_directory(os.getcwd()) as tmp:
pdblist = PDBList(server="http://invalid.server", pdb=tmp)
result = pdblist.retrieve_pdb_file("127d", file_format="pdb")
self.assertIsNone(result)
class TestPDBListGetAssembly(unittest.TestCase):
"""Test methods responsible for getting assemblies."""