def test_parseLine2(mocker): """ Test parseLine with bad data (some fields missing) Expected result: result is None """ # given: setup test framework worker = Worker() testString = "11/11/19,Brighter Futures,12000" # when: result = worker.parseLine(testString) # then: (Using PyTruth assertions) AssertThat(result).IsNone()
def test_parseLine1(mocker): """ Test parseLine with good data (all fields present) Expected result: dict returne with data """ # given: setup test framework worker = Worker() testString = "11/11/19,Teacher,Brighter Futures,12000" expectedResult = { 'date': '11/11/2019', 'job_title': 'Teacher', 'company_name': 'Brighter Futures', 'salary': 12000 } # when: result = worker.parseLine(testString) # then: assert result == expectedResult
def test_worker_parseLine_generative(input): worker = Worker() AssertThat(worker.parseLine(input)).IsNone()