import unittest import Tests.Fixtures from Errors import RecordError import LEHD class OriginDestinationRecordParserTest(unittest.TestCase): def setUp(self): self.odrp = LEHD.OriginDestinationRecordParser() def testAllOfSubsetParsed(self): fixture_path = Tests.Fixtures.Path() + '/LEHD/ten_records.csv' records = self.odrp.parse_file(fixture_path) self.assertEqual(len(records), 10) def testErrorOnMissingColumns(self): fixture_path = Tests.Fixtures.Path() + '/LEHD/ten_records-twelve_columns.csv' self.assertRaises(RecordError, self.odrp.parse_file, fixture_path) def testErrorOnMissingHeader(self): fixture_path = Tests.Fixtures.Path() + '/LEHD/ten_records-no_header.csv' self.assertRaises(RecordError, self.odrp.parse_file, fixture_path) def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(OriginDestinationRecordParserTest)) return suite