handle structures with 100,000 or more atoms
- the pdb format requires a 5-character field for the atom number; the hybrid-36 format allows up to a ridiculous number of atoms
This commit is contained in:
57
Tests/hybrid36.py
Normal file
57
Tests/hybrid36.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import unittest
|
||||
|
||||
import propka.hybrid36 as hybrid36
|
||||
|
||||
class Hybrid36Test(unittest.TestCase):
|
||||
def testDecode(self):
|
||||
test_values = {
|
||||
"99999": 99999,
|
||||
"A0000": 100000,
|
||||
"0": 0,
|
||||
"9": 9,
|
||||
"A": 10,
|
||||
" ZZZZY": 43770014,
|
||||
"ZZZZZ": 43770015, # ZZZZZ - A0000 + 100000
|
||||
"a0000": 43770016,
|
||||
"zzzzz": 87440031,
|
||||
"zzzzy": 87440030,
|
||||
"99": 99,
|
||||
"A0": 100,
|
||||
"ZZ": 1035,
|
||||
"zz": 1971,
|
||||
"-99999": -99999,
|
||||
"-A0000": -100000,
|
||||
"-0": 0,
|
||||
"-9": -9,
|
||||
"-A": -10,
|
||||
"-ZZZZY": -43770014,
|
||||
"-ZZZZZ": -43770015, # ZZZZZ - A0000 + 100000
|
||||
"-a0000": -43770016,
|
||||
"-zzzzz": -87440031,
|
||||
"-zzzzy": -87440030,
|
||||
"-99": -99,
|
||||
"-A0": -100,
|
||||
"-ZZ": -1035,
|
||||
"-zz": -1971,
|
||||
"PROPKA": 954495146,
|
||||
"A001Z": 100071,
|
||||
"B0000": 1779616,
|
||||
}
|
||||
|
||||
for k, v in test_values.iteritems():
|
||||
self.assertEqual(hybrid36.decode(k), v)
|
||||
|
||||
def testErrors(self):
|
||||
test_values = [
|
||||
"99X99",
|
||||
"X9-99",
|
||||
"XYZa",
|
||||
"",
|
||||
"-",
|
||||
"!NotOk",
|
||||
]
|
||||
|
||||
for v in test_values:
|
||||
with self.assertRaises(ValueError) as e:
|
||||
hybrid36.decode(v)
|
||||
self.assertTrue(v in str(e.exception))
|
||||
Reference in New Issue
Block a user