class TrackingTestCase(unittest.TestCase): def setUp(self): reader = csv.reader(open("cuffcmp_test.tracking00", 'r'), delimiter="\t") row = reader.next() self.tracking = TrackingParser(row) def test_CreateTrackingObj(self): '''Test object parser''' self.assertEqual("XLOC_000003", self.tracking.locusId) self.assertEqual("LOC643837|uc001abr.1", self.tracking.referenceId) self.assertEqual(32, len(self.tracking.samples)) def test_ParserSampleColumn1(self): '''Test parsing of a sample column''' result = self.tracking.parseSampleColumn(self.tracking.samples[0]) self.assertEqual("q1:CUFF.60", result["gene_id"]) self.assertEqual("CUFF.60.1", result["transcript_id"]) self.assertEqual("100", result["fmi"]) self.assertEqual("1.790260", result["fpkm"]) self.assertEqual("0.000000", result["conf_lo"]) self.assertEqual("4.466272", result["conf_hi"]) self.assertEqual("11.663309", result["cov"]) self.assertEqual("-", result["len"]) def test_SampleHits(self): '''Test the generator function sampleHits()''' expected = 1 result = 0 for hit in self.tracking.sampleHits(): result += 1 self.assertEqual(expected, result) def test_NumberOfSampleHits(self): '''Test the counting function numberOfSampleHits()''' expected = 1 result = self.tracking.numberOfSampleHits() self.assertEqual(expected, result)
def setUp(self): reader = csv.reader(open("cuffcmp_test.tracking00", 'r'), delimiter="\t") row = reader.next() self.tracking = TrackingParser(row)