Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#ImporttheCircleclassfromthecirclemoduleusingtheexpressionfromproj.circleimportCircle #Importassert_raisesfromnose.toolsusingtheexpressionfromnose.toolsimportassert_raises,eq_. #Useeq_methodforassert,andtocheck.Don'tuseassertstatement. #Defineanosetestclass'TestingCircleCreation' classTestingCircleCreation: #Defineanosetestmethod'test_creating_circle_with_numeric_radius',whichcreatesacirclewithradius2.5,andcheckifitsradiusvalueis2.5usingeq_method. deftest_creating_circle_with_numeric_radius(self): eq_() #Defineanosetestmethod'test_creating_circle_with_negative_radius',whichchecksiftheValueErrorexceptionisraisedwiththeerrormessageradiusmustbebetween0and1000inclusiveusingeq_method,whilecreatingacircleofradius-2.5. #Hint:Useassert_raisesandwith. deftest_creating_circle_with_negative_radius(self): eq_() #Defineanosetestmethod'test_creating_circle_with_greaterthan_radius',whichchecksiftheValueErrorexceptionisraisedwiththeerrormessageradiusmustbebetween0and1000inclusiveusingeq_method,whilecreatingcircleofradius1000.1. #Hint:Useassert_raisesandwith deftest_creating_circle_with_greaterthan_radius(self): eq_() #Defineanosetestmethod'test_creating_circle_with_nonnumeric_radius',whichchecksiftheTypeErrorexceptionisraisedwiththeerrormessageradiusmustbeanumberusingeq_method,whilecreatingcircleofradius'hello'. #Hint:Useassert_raisesandwith. deftest_creating_circle_with_nonnumeric_radius(self): eq_() #Defineanosetestclass'TestCircleArea' classTestCircleArea: #Defineanosetestmethod'test_circlearea_with_random_numeric_radius',whichcreatesacircle'c1'withradius2.5,andcheckifitscomputedareais19.63usingeq_method. deftest_circlearea_with_random_numeric_radius(self): eq_()

#ImporttheCircleclassfromthecirclemoduleusingtheexpressionfromproj.circleimportCircle

#Importassert_raisesfromnose.toolsusingtheexpressionfromnose.toolsimportassert_raises,eq_.

#Useeq_methodforassert,andtocheck.Don'tuseassertstatement.

#Defineanosetestclass'TestingCircleCreation'

classTestingCircleCreation:

#Defineanosetestmethod'test_creating_circle_with_numeric_radius',whichcreatesacirclewithradius2.5,andcheckifitsradiusvalueis2.5usingeq_method.

deftest_creating_circle_with_numeric_radius(self):

eq_()

#Defineanosetestmethod'test_creating_circle_with_negative_radius',whichchecksiftheValueErrorexceptionisraisedwiththeerrormessage"radiusmustbebetween0and1000inclusive"usingeq_method,whilecreatingacircleofradius-2.5.

#Hint:Useassert_raisesandwith.

deftest_creating_circle_with_negative_radius(self):

eq_()

#Defineanosetestmethod'test_creating_circle_with_greaterthan_radius',whichchecksiftheValueErrorexceptionisraisedwiththeerrormessage"radiusmustbebetween0and1000inclusive"usingeq_method,whilecreatingcircleofradius1000.1.

#Hint:Useassert_raisesandwith

deftest_creating_circle_with_greaterthan_radius(self):

eq_()

#Defineanosetestmethod'test_creating_circle_with_nonnumeric_radius',whichchecksiftheTypeErrorexceptionisraisedwiththeerrormessage"radiusmustbeanumber"usingeq_method,whilecreatingcircleofradius'hello'.

#Hint:Useassert_raisesandwith.

deftest_creating_circle_with_nonnumeric_radius(self):

eq_()

#Defineanosetestclass'TestCircleArea'

classTestCircleArea:

#Defineanosetestmethod'test_circlearea_with_random_numeric_radius',whichcreatesacircle'c1'withradius2.5,andcheckifitscomputedareais19.63usingeq_method.

deftest_circlearea_with_random_numeric_radius(self):

eq_()

#Defineanosetestmethod'test_circlearea_with_min_radius',whichcreatesacircle'c2'withradius0,andcheckifitscomputedareais0usingeq_method.

deftest_circlearea_with_min_radius(self):

eq_()

#Defineanosetestmethod'test_circlearea_with_max_radius',whichcreatesacircle'c3'withradius1000,andcheckifitscomputedareais3141592.65usingeq_method.

deftest_circlearea_with_max_radius(self):

eq_()

#Defineanosetestclass'TestCircleCircumference'

classTestCircleCircumference:

#Defineanosetestmethod'test_circlecircum_with_random_numeric_radius',whichcreatesacircle'c1'withradius2.5,andcheckifitscomputedcircumferenceis15.71usingeq_method.

deftest_circlecircum_with_random_numeric_radius(self):

eq_()

#Defineanosetestmethod'test_circlecircum_with_min_radius',whichcreatesacircle'c2'withradius0,andcheckifitscomputedcircumferenceis0usingeq_method.

deftest_circlecircum_with_min_radius(self):

eq_()

#Defineanosetestmethod'test_circlecircum_with_max_radius',whichcreatesacircle'c3'withradius1000,andcheckifitscomputedcircumferenceis6283.19usingeq_method.

deftest_circlecircum_with_max_radius(self):

eq_()

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

More Books

Students also viewed these Programming questions

Question

I wanna make a For loop to print 15 random numbers from 1 to 50

Answered: 1 week ago

Question

What is Entrepreneur?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago