Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing unit tests. Complete the unit tests for testing the evens() and odds() methods. Each unit test should call either odds() or evens(), passing in

Writing unit tests.

Complete the unit tests for testing the evens() and odds() methods. Each unit test should call either odds() or evens(), passing in a known array of values, and then testing the result to ensure only the correct values are in the array. (Hint: Use the self.assertIn() method).

import unittest

def evens(numbers): """Return the even values in numbers""" return [i for i in numbers if (i%2 == 0)]

def odds(numbers): """Return the odd values in numbers""" return [i for i in numbers if (i%2 == 1)]

class TestNumbers(unittest.TestCase): test_nums = [1, 3, 5, 6, 8, 2, 1]

def test_evens(self): # Fill in the unit test.

def test_odds(self): # Fill in the unit test

if __name__ == "__main__": unittest.main()

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

=+What the product does for the end-user.)

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago