예제 #1
0
class TestBook(TestItem):

    def setUp(self):
        self.pages = random.randint(50, 1000)
        self.cover = 'hardcover'
        self.item = Book(self.pages, self.cover)

    def test_pages_set_in_constructor(self):
        self.assertEqual(self.item.pages, self.pages)

    def test_cover_set_in_constructor(self):
        self.assertEqual(self.item.cover, self.cover)

    def test_mark_read_sets_read_variable(self):
        self.item.mark_read()
        self.assertTrue(self.item.read)
예제 #2
0
 def setUp(self):
     self.pages = random.randint(50, 1000)
     self.cover = 'hardcover'
     self.item = Book(self.pages, self.cover)