w04c_test_public.pyXw04c_tpl.py X def print_frame(): 1 2 3 4 5 € 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 pass L def is_valid_num(): return False Edef main (): 8 while True num_frames= input('Enter number of frames from 2 to 10 inclusive: ') if not is_valid_num (num_frames): print('Entered input is either not a number or is not between 2 and 10 inclusive. Please try again.') continue num_frames=int (num_frames) print frame (num_frames) break Bif name L main () _main__':

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Fulfilled the test case in the provided images

 

This is not a graded assignment. I just need some help

w04c_test_public.pyXw04c_tpl.py X
def print_frame ():
L
8
pass
def is_valid_num():
return False
def main ():
A while True:
num frames= input('Enter number of frames from 2 to 10 inclusive: ')
if not is valid_num (num_frames):
print('Entered input is either not a number or is not between 2 and 10 inclusive.
continue
num_frames= int (num frames)
print frame (num_frames)
break
name
main ()
== '___main__":
Please try again.')
Transcribed Image Text:w04c_test_public.pyXw04c_tpl.py X def print_frame (): L 8 pass def is_valid_num(): return False def main (): A while True: num frames= input('Enter number of frames from 2 to 10 inclusive: ') if not is valid_num (num_frames): print('Entered input is either not a number or is not between 2 and 10 inclusive. continue num_frames= int (num frames) print frame (num_frames) break name main () == '___main__": Please try again.')
w04c_test_public.py x w04c_tpl.py X
import io
import textwrap
1
2
3
4
5
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
in A
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
0-0
파
import unittest
from unittest.mock import patch
-0-0
#TODO: Replace w04c_ans with the name of your Python file.
Make sure that this file and that file are in the same
folder.
#
THI
#
from w04c_ans import print_frame, is_valid_num
class TestIsValidNum (unittest. TestCase) :
def test_pt01 (self):
if
a_test= is_valid_num ('2')
self.assertTrue (a_test)
def test_pt02 (self):
a_test= is_valid_num ('-5')
self.assertFalse (a_test)
def test_pt03 (self):
-
class TestPrintFrame (unittest. TestCase):
@patch('sys.stdout', new_callable-io. StringIO)
def test_pt01 (self, mocked_print):
print_frame ()
a_test= is_valid_num ('512abc32')
self.assertFalse (a_test)
self.assertEqual (
name
mocked_print.getvalue (),
textwrap.dedent (
=
main ':
unittest.main ()
Transcribed Image Text:w04c_test_public.py x w04c_tpl.py X import io import textwrap 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 in A 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 0-0 파 import unittest from unittest.mock import patch -0-0 #TODO: Replace w04c_ans with the name of your Python file. Make sure that this file and that file are in the same folder. # THI # from w04c_ans import print_frame, is_valid_num class TestIsValidNum (unittest. TestCase) : def test_pt01 (self): if a_test= is_valid_num ('2') self.assertTrue (a_test) def test_pt02 (self): a_test= is_valid_num ('-5') self.assertFalse (a_test) def test_pt03 (self): - class TestPrintFrame (unittest. TestCase): @patch('sys.stdout', new_callable-io. StringIO) def test_pt01 (self, mocked_print): print_frame () a_test= is_valid_num ('512abc32') self.assertFalse (a_test) self.assertEqual ( name mocked_print.getvalue (), textwrap.dedent ( = main ': unittest.main ()
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY