Пример #1
0
 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())
Пример #2
0
 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)
Пример #3
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, identity)
     self.assertEqual("100-200 site. note: Capsid protein", feature.legendLabel())
Пример #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, identity)
     feature.setColor("red")
     self.assertEqual("red", feature.color)
Пример #5
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, identity, subfeature=True)
     self.assertTrue(feature.subfeature)
Пример #6
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, identity)
     self.assertEqual("100-200 site.", feature.legendLabel())
Пример #7
0
 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())
Пример #8
0
 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())
Пример #9
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, identity)
     xs = "x" * 27 + "..."
     self.assertEqual("100-200 site. note: %s" % xs, feature.legendLabel())