Пример #1
0
 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
Пример #2
0
 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())
Пример #3
0
 def testParse(self):
     """Test if all records in a DES file are being read."""
     count = 0
     with open(self.filename) as f:
         records = Des.parse(f)
         for record in records:
             count += 1
     self.assertEqual(count, 20)
Пример #4
0
 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()
Пример #5
0
 def testParse(self):
    f = open(self.filename)
    try: 
        count = 0
        records = Des.parse(f)
        for record in records:
            count +=1
        assert count == 20, "Wrong number of records?!"
    finally:
        f.close()
Пример #6
0
 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()
Пример #7
0
    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]
Пример #8
0
 def testParse(self):
     f = open(self.filename)
     try:
         count = 0
         records = Des.parse(f)
         for record in records:
             count += 1
         assert count == 20, "Wrong number of records?!"
     finally:
         f.close()
Пример #9
0
    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])
Пример #10
0
 def testParse(self):
     """Test if all records in a DES file are being read"""
     f = open(self.filename)
     try:
         count = 0
         records = Des.parse(f)
         for record in records:
             count +=1
         self.assertEqual(count, 20)
     finally:
         f.close()
Пример #11
0
    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])