def testParse(self): """Test if all records in a HIE file are being read.""" count = 0 with open(self.filename) as f: for record in Hie.parse(f): count += 1 self.assertEqual(count, 21)
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 = Hie.Record(line) # End of line is platform dependent. Strip it off self.assertEqual(str(record).rstrip(), line.rstrip())
def testError(self): corruptRec = "4926sdfhjhfgyjdfyg" try: rec = Hie.Record(corruptRec) assert False, "Should never get here" except ValueError, e: pass
def testStr(self): f = open(self.filename) try: for line in f: record = Hie.Record(line) #End of line is platform dependent. Strip it off assert str(record).rstrip() == line.rstrip() finally: f.close()
def testParse(self): f = open(self.filename) try: count = 0 for record in Hie.parse(f): count += 1 assert count == 21, "Wrong number of records?! " + str(count) finally: f.close()
def testParse(self): f = open(self.filename) try: count = 0 for record in Hie.parse(f): count +=1 assert count == 21, "Wrong number of records?! "+str(count) finally: f.close()
def testParse(self): """Test if all records in a HIE file are being read.""" f = open(self.filename) try: count = 0 for record in Hie.parse(f): count += 1 self.assertEqual(count, 21) finally: f.close()
def testParse(self): """Test if all records in a HIE file are being read""" f = open(self.filename) try: count = 0 for record in Hie.parse(f): count += 1 self.assertEqual(count, 21) 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 = Hie.Record(line) #End of line is platform dependent. Strip it off self.assertEqual(str(record).rstrip(), line.rstrip()) finally: f.close()