def testEnd(self): """ The end method must return the feature start. """ location = FeatureLocation(100, 200) seqFeature = SeqFeature(location=location) feature = _Feature(seqFeature, identity) self.assertEqual(200, feature.end())
def testNotSubfeatureByDefault(self): """ A feature must not be a subfeature by default. """ location = FeatureLocation(100, 200) seqFeature = SeqFeature(location=location) feature = _Feature(seqFeature, identity) self.assertFalse(feature.subfeature)
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, identity) self.assertEqual("100-200 site. note: Capsid protein", feature.legendLabel())
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, identity) feature.setColor("red") self.assertEqual("red", feature.color)
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, identity, subfeature=True) self.assertTrue(feature.subfeature)
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, identity) self.assertEqual("100-200 site.", feature.legendLabel())
def testEndWithOffsetAdjuster(self): """ The end method must return the feature end, as adjusted by the passed offset adjuster. """ adjuster = lambda x: 3 * x location = FeatureLocation(100, 200) seqFeature = SeqFeature(location=location) feature = _Feature(seqFeature, adjuster) self.assertEqual(600, feature.end())
def testStartWithOffsetAdjuster(self): """ The start method must return the feature start, as adjusted by the passed offset adjuster. """ adjuster = lambda x: 3 * x location = FeatureLocation(100, 200) seqFeature = SeqFeature(location=location) feature = _Feature(seqFeature, adjuster) self.assertEqual(300, feature.start())
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, identity) xs = "x" * 27 + "..." self.assertEqual("100-200 site. note: %s" % xs, feature.legendLabel())