Esempio n. 1
0
 def setUp(self):
     self.carnivorous = Carnivorous()
Esempio n. 2
0
class TestEx9(unittest.TestCase):

    def setUp(self):
        self.carnivorous = Carnivorous()

    def test_eat_anything(self):
        rectangle = Rectangle(20, 10)
        self.carnivorous.eat(1) |should| equal_to([1])
        self.carnivorous.eat('a') |should| equal_to([1, 'a'])
        self.carnivorous.eat(rectangle) |should| equal_to([1, 'a', rectangle])

    def test_digest(self):
        rectangle = Rectangle(20, 10)
        self.carnivorous.eat(1) |should| equal_to([1])
        self.carnivorous.eat('a') |should| equal_to([1, 'a'])
        self.carnivorous.eat(rectangle) |should| equal_to([1, 'a', rectangle])
        self.carnivorous.digest() |should| equal_to(1)
        self.carnivorous.digest() |should| equal_to('a')
        self.carnivorous.stomach |should| equal_to([rectangle])