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)
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())
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 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())
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)
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)
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)
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)