Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Tasks: 1 . Complete Task 1 : Develop Unit Tests for Load Data Module. 2 . Complete Task 2 : Complete the test _ load
Tasks:
Complete Task : Develop Unit Tests for Load Data Module.
Complete Task : Complete the testloaddata Module.
Task : Develop Unit Tests for Load Data Module
As a team, you will write four different test cases for your loaddata module. Remember to use
automated testing, as you learned during the lectures. You need to import the check module
explained during the lectures. Use the functions in the check module in your implementation.
You are not allowed to modify the check module.
Docstring and type annotations are not required for this lab.
For your tests, use the characterstest.csv file provided.
STEP
Read the descriptions of the tests below.
Decide who is writing which test.
Test : Functions Return a List
In a file named testpy write a test function named testreturnlist to test that all six functions in
the load data module return a list.
For each function except loaddata you need to provide at least test cases:
functions testfunction test cases
For function loaddata, you need to provide test cases.
Thats test cases in total.
The function is the folowing:
def characteroccupationlistfile: str occupation: str:
occupationls
targetfile openfiler
firstline True
for line in targetfile:
person
line line.strip
split
if firstline:
firstline False
header line
else:
if occupation in line:
for i in range lenheader:
if i :
personheaderi floatlinei
elif i :
personheaderi strlinei
else:
personheaderi intlinei
occupationlsappendperson
targetfile.close
return occupationls
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started