Question: Question>>>Python # Import the Circle class from the circle module using the expression from proj.circle import Circle # Import assert_raises from nose.tools using the expression

Question>>>Python

# Import the Circle class from the circle module using the expression from proj.circle import Circle

# Import assert_raises from nose.tools using the expression from nose.tools import assert_raises, eq_.

# Use eq_ method for assert, and to check. Don't use assert statement.

# Define a nose test class 'TestingCircleCreation'

class TestingCircleCreation:

# Define a nose test method 'test_creating_circle_with_numeric_radius', which creates a circle with radius 2.5, and check if its radius value is 2.5 using eq_ method.

def test_creating_circle_with_numeric_radius(self):

eq_()

# Define a nose test method 'test_creating_circle_with_negative_radius', which checks if the ValueError exception is raised with the error message "radius must be between 0 and 1000 inclusive" using eq_ method, while creating a circle of radius -2.5.

# Hint: Use assert_raises and with.

def test_creating_circle_with_negative_radius(self):

eq_()

# Define a nose test method 'test_creating_circle_with_greaterthan_radius', which checks if the ValueError exception is raised with the error message "radius must be between 0 and 1000 inclusive" using eq_ method, while creating circle of radius 1000.1 .

# Hint: Use assert_raises and with

def test_creating_circle_with_greaterthan_radius(self):

eq_()

# Define a nose test method 'test_creating_circle_with_nonnumeric_radius', which checks if the TypeError exception is raised with the error message "radius must be a number" using eq_ method, while creating circle of radius 'hello' .

# Hint: Use assert_raises and with.

def test_creating_circle_with_nonnumeric_radius(self):

eq_()

#Define a nose test class 'TestCircleArea'

class TestCircleArea:

# Define a nose test method 'test_circlearea_with_random_numeric_radius', which creates a circle 'c1' with radius 2.5, and check if its computed area is 19.63 using eq_ method.

def test_circlearea_with_random_numeric_radius(self):

eq_()

# Define a nose test method 'test_circlearea_with_min_radius', which creates a circle 'c2' with radius 0, and check if its computed area is 0 using eq_ method.

def test_circlearea_with_min_radius(self):

eq_()

# Define a nose test method 'test_circlearea_with_max_radius', which creates a circle 'c3' with radius 1000, and check if its computed area is 3141592.65 using eq_ method.

def test_circlearea_with_max_radius(self):

eq_()

# Define a nose test class 'TestCircleCircumference'

class TestCircleCircumference:

# Define a nose test method 'test_circlecircum_with_random_numeric_radius', which creates a circle 'c1' with radius 2.5, and check if its computed circumference is 15.71 using eq_ method.

def test_circlecircum_with_random_numeric_radius(self):

eq_()

# Define a nose test method 'test_circlecircum_with_min_radius', which creates a circle 'c2' with radius 0, and check if its computed circumference is 0 using eq_ method.

def test_circlecircum_with_min_radius(self):

eq_()

# Define a nose test method 'test_circlecircum_with_max_radius', which creates a circle 'c3' with radius 1000, and check if its computed circumference is 6283.19 using eq_ method.

def test_circlecircum_with_max_radius(self):

eq_()

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 Programming Questions!