Example #1
0
 def testSetColor(self):
     """
     The setColor method must set the 'color' attribute on the feature.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature)
     feature.setColor('red')
     self.assertEqual('red', feature.color)
Example #2
0
 def testLegendLabelNoQualifiers(self):
     """
     The legendLabel method must return a correct description for a feature
     that has no qualifiers.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location, type='site')
     feature = Feature(seqFeature)
     self.assertEqual('100-200 site.', feature.legendLabel())
Example #3
0
 def testLegendLabelNoQualifiers(self):
     """
     The legendLabel method must return a correct description for a feature
     that has no qualifiers.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location, type='site')
     feature = Feature(seqFeature)
     self.assertEqual('100-200 site.', feature.legendLabel())
Example #4
0
 def testSetColor(self):
     """
     The setColor method must set the 'color' attribute on the feature.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature)
     feature.setColor('red')
     self.assertEqual('red', feature.color)
Example #5
0
 def testLegendLabel(self):
     """
     The legendLabel method must return a description.
     """
     location = FeatureLocation(100, 200)
     qualifiers = {
         'note': ['Capsid protein'],
     }
     seqFeature = SeqFeature(location=location, type='site',
                             qualifiers=qualifiers)
     feature = Feature(seqFeature)
     self.assertEqual('100-200 site. note: Capsid protein',
                      feature.legendLabel())
 def testLegendLabel(self):
     """
     The legendLabel method must return a description.
     """
     location = FeatureLocation(100, 200)
     qualifiers = {
         'note': ['Capsid protein'],
     }
     seqFeature = SeqFeature(location=location, type='site',
                             qualifiers=qualifiers)
     feature = Feature(seqFeature)
     self.assertEqual('100-200 site. note: Capsid protein',
                      feature.legendLabel())
Example #7
0
 def testLegendLabelTruncatesValues(self):
     """
     The legendLabel method must return a description with qualifier
     values truncated to length 30 (including the trailing ...).
     """
     location = FeatureLocation(100, 200)
     qualifiers = {
         'note': ['x' * 40],
     }
     seqFeature = SeqFeature(location=location,
                             type='site',
                             qualifiers=qualifiers)
     feature = Feature(seqFeature)
     xs = 'x' * 27 + '...'
     self.assertEqual('100-200 site. note: %s' % xs, feature.legendLabel())
Example #8
0
 def testLegendLabelTruncatesValues(self):
     """
     The legendLabel method must return a description with qualifier
     values truncated to length 30 (including the trailing ...).
     """
     location = FeatureLocation(100, 200)
     qualifiers = {
         'note': ['x' * 40],
     }
     seqFeature = SeqFeature(location=location, type='site',
                             qualifiers=qualifiers)
     feature = Feature(seqFeature)
     xs = 'x' * 27 + '...'
     self.assertEqual('100-200 site. note: %s' % xs,
                      feature.legendLabel())
Example #9
0
 def testEnd(self):
     """
     The end attribute must hold the feature start.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature)
     self.assertEqual(200, feature.end)
Example #10
0
 def testStart(self):
     """
     The start attribute must hold the feature's start.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature)
     self.assertEqual(100, feature.start)
Example #11
0
 def testNotSubfeatureByDefault(self):
     """
     A feature must not be a subfeature by default.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature)
     self.assertFalse(feature.subfeature)
Example #12
0
 def testSubfeature(self):
     """
     A feature must be a subfeature if it is passed C{subfeature} = C{True}
     on initialization.
     """
     location = FeatureLocation(100, 200)
     seqFeature = SeqFeature(location=location)
     feature = Feature(seqFeature, subfeature=True)
     self.assertTrue(feature.subfeature)