aboutsummaryrefslogtreecommitdiff
path: root/plip/test
diff options
context:
space:
mode:
Diffstat (limited to 'plip/test')
-rw-r--r--plip/test/test_command_line.py31
-rw-r--r--plip/test/test_hydrogen_bonds.py18
2 files changed, 32 insertions, 17 deletions
diff --git a/plip/test/test_command_line.py b/plip/test/test_command_line.py
index d3ab332..b561997 100644
--- a/plip/test/test_command_line.py
+++ b/plip/test/test_command_line.py
@@ -20,35 +20,46 @@ class CommandLineTest(unittest.TestCase):
def test_empty_input_file(self):
"""Input file is empty."""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -f ./special/empty.pdb -o {self.tmp_dir.name}',
- shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -f ./special/empty.pdb -o {self.tmp_dir.name}",
+ shell=True,
+ )
self.assertEqual(exitcode, 1)
def test_invalid_pdb_id(self):
"""A PDB ID with no valid PDB record is provided."""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -i xx1x -o {self.tmp_dir.name}', shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -i xx1x -o {self.tmp_dir.name}", shell=True
+ )
self.assertEqual(exitcode, 1)
def test_invalid_input_file(self):
"""A file is provided which is not a PDB file."""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -f ./special/non-pdb.pdb -o {self.tmp_dir.name}',
- shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -f ./special/non-pdb.pdb -o {self.tmp_dir.name}",
+ shell=True,
+ )
self.assertEqual(exitcode, 1)
def test_pdb_format_not_available(self):
"""A valid PDB ID is provided, but there is no entry in PDB format from wwPDB"""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -i 4v59 -o {self.tmp_dir.name}', shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -i 4v59 -o {self.tmp_dir.name}", shell=True
+ )
self.assertEqual(exitcode, 1)
def test_valid_pdb(self):
"""A PDB ID with no valid PDB record is provided."""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -x -f ./pdb/1eve.pdb -o {self.tmp_dir.name}',
- shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -x -f ./pdb/1eve.pdb -o {self.tmp_dir.name}",
+ shell=True,
+ )
self.assertEqual(len(os.listdir(self.tmp_dir.name)), 2)
self.assertEqual(exitcode, 0)
def test_stdout(self):
"""A PDB ID with no valid PDB record is provided."""
- exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -t -f ./pdb/1eve.pdb -O', shell=True)
+ exitcode = subprocess.call(
+ f"{sys.executable} ../plipcmd.py -t -f ./pdb/1eve.pdb -O", shell=True
+ )
self.assertEqual(exitcode, 0)
-
diff --git a/plip/test/test_hydrogen_bonds.py b/plip/test/test_hydrogen_bonds.py
index 75cae6c..f673c6e 100644
--- a/plip/test/test_hydrogen_bonds.py
+++ b/plip/test/test_hydrogen_bonds.py
@@ -8,31 +8,35 @@ def characterize_complex(pdb_file: str, binding_site_id: str) -> PLInteraction:
pdb_complex = PDBComplex()
pdb_complex.load_pdb(pdb_file)
for ligand in pdb_complex.ligands:
- if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == binding_site_id:
+ if (
+ ":".join([ligand.hetid, ligand.chain, str(ligand.position)])
+ == binding_site_id
+ ):
pdb_complex.characterize_complex(ligand)
return pdb_complex.interaction_sets[binding_site_id]
class HydrogenBondTestCase(unittest.TestCase):
-
def test_4dst_nondeterministic_protonation(self):
config.NOHYDRO = False
for i in range(0, 10):
- interactions = characterize_complex('./pdb/4dst.pdb', 'GCP:A:202')
+ interactions = characterize_complex("./pdb/4dst.pdb", "GCP:A:202")
all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon
self.assertTrue(len(all_hbonds) == 16 or len(all_hbonds) == 17)
def test_4dst_deterministic_protonation(self):
config.NOHYDRO = True
for i in range(0, 10):
- interactions = characterize_complex('./pdb/4dst_protonated.pdb', 'GCP:A:202')
+ interactions = characterize_complex(
+ "./pdb/4dst_protonated.pdb", "GCP:A:202"
+ )
all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon
self.assertTrue(len(all_hbonds) == 16)
def test_no_protonation(self):
config.NOHYDRO = True
- interactions1 = characterize_complex('./pdb/1x0n_state_1.pdb', 'DTF:A:174')
+ interactions1 = characterize_complex("./pdb/1x0n_state_1.pdb", "DTF:A:174")
self.assertEqual(len(interactions1.hbonds_ldon), 0)
config.NOHYDRO = False
- interactions2 = characterize_complex('./pdb/1x0n_state_1.pdb', 'DTF:A:174')
- self.assertEqual(len(interactions2.hbonds_ldon), 1) \ No newline at end of file
+ interactions2 = characterize_complex("./pdb/1x0n_state_1.pdb", "DTF:A:174")
+ self.assertEqual(len(interactions2.hbonds_ldon), 1)