def testError(self): corruptRec = "49268\tsp\tb.1.2.1\t-\n" try: record = Des.Record(corruptRec) assert False, "Should never get here" except ValueError, e: pass
def testStr(self): """Test if we can convert each record to a string correctly.""" with open(self.filename) as f: for line in f: record = Des.Record(line) # End of line is platform dependent. Strip it off self.assertEqual(str(record).rstrip(), line.rstrip())
def testStr(self): f = open(self.filename) try: for line in f: record = Des.Record(line) #End of line is plateform dependant. Strip it off assert str(record).rstrip() == line.rstrip() finally: f.close()
def testStr(self): """Test if we can convert each record to a string correctly""" f = open(self.filename) try: for line in f: record = Des.Record(line) #End of line is platform dependent. Strip it off self.assertEqual(str(record).rstrip(), line.rstrip()) finally: f.close()
def testRecord(self): recLine = '49268\tsp\tb.1.2.1\t-\tHuman (H**o sapiens) \n' recFields = (49268, 'sp', 'b.1.2.1', '', 'Human (H**o sapiens)') record = Des.Record(recLine) assert record.sunid == recFields[0] assert record.nodetype == recFields[1] assert record.sccs == recFields[2] assert record.name == recFields[3] assert record.description == recFields[4]
def testRecord(self): """Test one record in detail""" recLine = '49268\tsp\tb.1.2.1\t-\tHuman (H**o sapiens) \n' recFields = (49268, 'sp', 'b.1.2.1', '', 'Human (H**o sapiens)') record = Des.Record(recLine) self.assertEqual(record.sunid, recFields[0]) self.assertEqual(record.nodetype, recFields[1]) self.assertEqual(record.sccs, recFields[2]) self.assertEqual(record.name, recFields[3]) self.assertEqual(record.description, recFields[4])
def testRecord(self): """Test one record in detail.""" recLine = "49268\tsp\tb.1.2.1\t-\tHuman (H**o sapiens) \n" recFields = (49268, "sp", "b.1.2.1", "", "Human (H**o sapiens)") record = Des.Record(recLine) self.assertEqual(record.sunid, recFields[0]) self.assertEqual(record.nodetype, recFields[1]) self.assertEqual(record.sccs, recFields[2]) self.assertEqual(record.name, recFields[3]) self.assertEqual(record.description, recFields[4])