Back to index

python-biopython  1.60
Public Member Functions
test_SeqRecord.SeqRecordCreation Class Reference

List of all members.

Public Member Functions

def test_annotations
def test_letter_annotations

Detailed Description

Test basic creation of SeqRecords.

Definition at line 19 of file test_SeqRecord.py.


Member Function Documentation

Pass in annotations to SeqRecords

Definition at line 21 of file test_SeqRecord.py.

00021 
00022     def test_annotations(self):
00023         """Pass in annotations to SeqRecords"""
00024         rec = SeqRecord(Seq("ACGT", generic_dna),
00025                         id="Test", name="Test", description="Test")
00026         self.assertEqual(rec.annotations, {})
00027         rec = SeqRecord(Seq("ACGT", generic_dna),
00028                         id="Test", name="Test", description="Test",
00029                         annotations={"test" : ["a test"]})
00030         self.assertEqual(rec.annotations["test"], ["a test"])

Pass in letter annotations to SeqRecords

Definition at line 31 of file test_SeqRecord.py.

00031 
00032     def test_letter_annotations(self):
00033         """Pass in letter annotations to SeqRecords"""
00034         rec = SeqRecord(Seq("ACGT", generic_dna),
00035                         id="Test", name="Test", description="Test")
00036         self.assertEqual(rec.annotations, {})
00037         rec = SeqRecord(Seq("ACGT", generic_dna),
00038                         id="Test", name="Test", description="Test",
00039                         letter_annotations={"test" : [1, 2, 3, 4]})
00040         self.assertEqual(rec.letter_annotations["test"], [1, 2, 3, 4])
00041         #Now try modifying it to a bad value...
00042         try:
00043             rec.letter_annotations["bad"] = "abc"
00044             self.assertTrue(False, "Adding a bad letter_annotation should fail!")
00045         except (TypeError, ValueError), e:
00046             pass
00047         #Now try setting it afterwards to a bad value...
00048         rec = SeqRecord(Seq("ACGT", generic_dna),
00049                         id="Test", name="Test", description="Test")
00050         try:
00051             rec.letter_annotations={"test" : [1, 2, 3]}
00052             self.assertTrue(False, "Changing to bad letter_annotations should fail!")
00053         except (TypeError, ValueError), e:
00054             pass
00055         #Now try setting it at creation time to a bad value...
00056         try:
00057             rec = SeqRecord(Seq("ACGT", generic_dna),
00058                             id="Test", name="Test", description="Test",
00059                             letter_annotations={"test" : [1, 2, 3]})
00060             self.assertTrue(False, "Wrong length letter_annotations should fail!")
00061         except (TypeError, ValueError), e:
00062             pass


The documentation for this class was generated from the following file: