Answered step by step
Verified Expert Solution
Link Copied!

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:
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions