Skip to content
Snippets Groups Projects
Commit 87c339ee authored by Studer Gabriel's avatar Studer Gabriel
Browse files

test remote loading in LoadPDB/LoadMMCIF

parent e0242435
Branches
Tags
No related merge requests found
import unittest import unittest
import subprocess
import ost import ost
from ost import * from ost import *
...@@ -249,6 +250,19 @@ class TestMMCifInfo(unittest.TestCase): ...@@ -249,6 +250,19 @@ class TestMMCifInfo(unittest.TestCase):
self.assertEqual(i.GetObsoleteInfo().GetPDBID(), '1FOO') self.assertEqual(i.GetObsoleteInfo().GetPDBID(), '1FOO')
self.assertEqual(i.GetObsoleteInfo().GetReplacedPDBID(), '2BAR') self.assertEqual(i.GetObsoleteInfo().GetReplacedPDBID(), '2BAR')
def test_remote_loading(self):
if subprocess.call(['ping google.com -c 1'], shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
print("No internet connection (or wrong OS) to test remote loading in "
"io.LoadMMCIF: ignoring unit test")
return
# let's hope that crambin stays the same forever
crambin_pdb = io.LoadMMCIF('1crn', remote=True)
self.assertEqual(len(crambin_pdb.residues), 46)
self.assertEqual(len(crambin_pdb.atoms), 327)
if __name__== '__main__': if __name__== '__main__':
from ost import testutils from ost import testutils
testutils.RunTests() testutils.RunTests()
......
import unittest import unittest
from ost import * from ost import *
import subprocess
class TestPDB(unittest.TestCase): class TestPDB(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -34,6 +35,22 @@ class TestPDB(unittest.TestCase): ...@@ -34,6 +35,22 @@ class TestPDB(unittest.TestCase):
self.assertFalse(mol.BondExists(res1.FindAtom("CA"),res1.FindAtom("CB"))) self.assertFalse(mol.BondExists(res1.FindAtom("CA"),res1.FindAtom("CB")))
self.assertTrue(mol.BondExists(res2.FindAtom("CA"),res2.FindAtom("CB"))) self.assertTrue(mol.BondExists(res2.FindAtom("CA"),res2.FindAtom("CB")))
self.assertTrue(mol.BondExists(resd.FindAtom("CA"),resd.FindAtom("CB"))) self.assertTrue(mol.BondExists(resd.FindAtom("CA"),resd.FindAtom("CB")))
def test_remote_loading(self):
if subprocess.call(['ping google.com -c 1'], shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
print("No internet connection (or wrong OS) to test remote loading in "
"io.LoadPDB: ignoring unit test")
return
with self.assertRaises(IOError):
io.LoadPDB('1ake', remote=True, remote_repo="cheeseisgoodforyou")
# let's hope that crambin stays the same forever
crambin_pdb = io.LoadPDB('1crn', remote=True, remote_repo='pdb')
self.assertEqual(len(crambin_pdb.residues), 46)
self.assertEqual(len(crambin_pdb.atoms), 327)
if __name__== '__main__': if __name__== '__main__':
from ost import testutils from ost import testutils
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment