Question
Python module that contains the following: A custom class named LandMammal that holds data facts regarding the world's largest land mammals. A main() function that
Python module that contains the following:
- A custom class namedLandMammalthat holds data facts regarding the world's largest land mammals.
- Amain()function that contains unit test cases for the LandMammal class.
TheLandMammalclass should implement a constructor that sets up the following instance variables:
- name (string)
- minimum mass in pounds (int)
- maximum mass in pounds (int)
Hint.Implement a constructor with__init__()
You will also need to provide a method namedmass_range()to calculate and return the following attribute:
- calculate the range of mass and return an int.
Themain()function should create test cases for the following:
- the constructor
- themass_range()method
Invoke themain()function with the final statements in your module making sure that unit test code only runs when the module is run by itself and not when the module is imported by another program.
Hint.Include the following statements at the end of your module.
if__name__=='__main__':
main()
When this program is run directly (rather than having been imported), the console session should contain the unit testing output and should look like this:
Unit testing output follows... Testing the constructor: African elephant 10000 24000 Testing the mass_range method: 14000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started