예제 #1
0
    def test_invalid_file(self):
        # Arrange

        # Act
        fileParser = FileParser('invalidFileName.blah')
        try:
            fileParser.parse()
            self.assertEqual(1, 2)
        except Exception:
            # Assert
            self.assertTrue
예제 #2
0
    def test_valid_file(self):
        # Arrange
        self.create_file(self.validData)

        # Act
        filePaser = FileParser(self.testFilePath)
        try:
            filePaser.parse()
            self.assertEqual(1, 1)
        except Exception:
            self.assertEqual(1, 2)

        # Clean up
        os.remove(self.testFilePath)
예제 #3
0
import sys
from fileParser import FileParser
from report import Report
from errorLog import ErrorLog

errorLog = ErrorLog()
errorLog.setPath("error.log")

# Check for an argument that should be a file name
if len(sys.argv) == 1:
    errorLog.log('Please provide the path to an input file')
    print('Please provide the path to an input file')
else:
    parser = FileParser(sys.argv[1])
    data = parser.parse()

    report = Report(data)
    # check if a file is provided for the output report
    if len(sys.argv) > 2:
        report.printReport(sys.argv[2])
    # output the record to the screen
    else:
        report.printReport()