Question: Tasks: 1 . Complete Task 1 : Develop Unit Tests for Load Data Module. 2 . Complete Task 2 : Complete the test _ load

Tasks:
1. Complete Task 1: Develop Unit Tests for Load Data Module.
2. Complete Task 2: Complete the test_load_data Module.
Task 1: Develop Unit Tests for Load Data Module
As a team, you will write four different test cases for your load_data 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 characters-test.csv file provided.
STEP 1
1. Read the descriptions of the tests below.
2. Decide who is writing which test.
Test 1: Functions Return a List
In a file named test1.py, write a test function named test_return_list to test that all six functions in
the load data module return a list.
For each function except load_data you need to provide at least 3 test cases:
5 functions *3 test/function =15 test cases
For function load_data, you need to provide 6 test cases.
Thats 21 test cases in total.
The function is the folowing:
def character_occupation_list(file: str, occupation: str):
occupation_ls =[]
targetfile = open(file,"r")
first_line = True
for line in targetfile:
person ={}
line = line.strip('
').split(',')
if first_line:
first_line = False
header = line
else:
if occupation in line:
for i in range(1, len(header)):
if i ==6:
person[header[i]]= float(line[i])
elif i ==8:
person[header[i]]= str(line[i])
else:
person[header[i]]= int(line[i])
occupation_ls.append(person)
targetfile.close()
return occupation_ls

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!