Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

80 lines (57 sloc) 2.032 kb
# Copyright 2001 by Gavin E. Crooks. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unit test for Des"""
import unittest
from Bio.SCOP import Des
from Bio.SCOP.Residues import Residues
import sys
def run_tests(argv):
test_suite = testing_suite()
runner = unittest.TextTestRunner(sys.stdout, verbosity = 2)
runner.run(test_suite)
def testing_suite():
return test_suite()
class DesTests(unittest.TestCase):
def setUp(self) :
self.filename = './SCOP/dir.des.scop.txt_test'
def testParse(self):
f = open(self.filename)
try:
count = 0
records = Des.parse(f)
for record in records:
count +=1
assert count == 20, "Wrong number of records?!"
finally:
f.close()
def testStr(self):
f = open(self.filename)
try:
for line in f:
record = Des.Record(line)
#End of line is plateform dependant. Strip it off
assert str(record).rstrip() == line.rstrip()
finally:
f.close()
def testError(self) :
corruptRec = "49268\tsp\tb.1.2.1\t-\n"
try:
record = Des.Record(corruptRec)
assert False, "Should never get here"
except ValueError, e :
pass
def testRecord(self) :
recLine = '49268\tsp\tb.1.2.1\t-\tHuman (Homo sapiens) \n'
recFields = (49268,'sp','b.1.2.1','','Human (Homo sapiens)')
record = Des.Record(recLine)
assert record.sunid == recFields[0]
assert record.nodetype == recFields[1]
assert record.sccs == recFields[2]
assert record.name == recFields[3]
assert record.description == recFields[4]
def test_suite():
return unittest.makeSuite(DesTests)
if __name__ == '__main__':
unittest.main()
Jump to Line
Something went wrong with that request. Please try again.