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