Question: Your task in this homework assignment is to create a unit test for a classes' attributes and methods. ## Solution Specifications Your solution to this

Your task in this homework assignment is to create a unit test for a classes' attributes and methods.

## Solution Specifications

Your solution to this problem must meet the following criteria.

1. You must declare `Test_Herbivorous` class that inherits `unittest.TestCase`.

2. You must define a instance method named `test_herbivorous` in the file `test_herbivorous.py` which test to confirm attributes and methods of the `Herbivorous` class.

3. The file `test_herbivorous.py` should not contain a main program, it should only contain your class. To test your class, execute the `run_test.py` file.

Note that code in `run_test.py` will not be graded.

4. Below is an example of a call to the unit test which you could implement in `run_test.py` to test your method.

Python Code:

```python

import unittest

from test_herbivorous import Test_Herbivorous

unittest.main()

```

Output:

```html

.

----------------------------------------------------------------------

Ran 1 test in 0.000s

OK

```

class Organism:

def __init__(self, cell_count):

self.multicellular = cell_count > 1

self.unicellular = cell_count == 1

def feed(self):

return "I eat food."

import organism

class Herbivorous(organism.Organism):

def __init__(self, species):

organism.Organism.__init__(self, 20000000)

self.species = species

def feed(self):

return "I am a {} species meaning I do not eat meat.".format(self.species)

import unittest

from test_herbivorous import Test_Herbivorous

unittest.main()

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