Exemplo n.º 1
0
    def test002_findBookFindsExistingBook(self):
        isbn = "0000-00000000"
        title = "Book Title"
        expected = title

        index = isbn_index.createIndex()
        isbn_index.recordBook(index, isbn, title)

        self.assertEqual(isbn_index.findBook(index, isbn), expected)
        return
    def test002_recordBookStoresOneBook(self):
        isbn = "0000-00000000"
        title = "Book Title"
        expected = {isbn: title}

        index = isbn_index.createIndex()
        isbn_index.recordBook(index, isbn, title)

        self.assertDictEqual(index, expected)
        return
Exemplo n.º 3
0
    def test003_findBookDoesNotFindMissingBook(self):
        isbn1 = "0000-00000000"
        isbn2 = "0000-12345678"
        title = "Book Title"
        expected = ""

        index = isbn_index.createIndex()
        isbn_index.recordBook(index, isbn1, title)

        self.assertEqual(isbn_index.findBook(index, isbn2), expected)
        return
    def test004_recordBookReplacesTitle(self):
        isbn1 = "0000-00000000"
        title1 = "Book Title"
        title2 = "War of the Worlds"
        expected = {isbn1: title2}

        index = isbn_index.createIndex()
        isbn_index.recordBook(index, isbn1, title1)
        isbn_index.recordBook(index, isbn1, title2)

        self.assertDictEqual(index, expected)
        return
    def test003_recordBookStoresTwoBooks(self):
        isbn1 = "0000-00000000"
        title1 = "Book Title"
        isbn2 = "0000-12345678"
        title2 = "War of the Worlds"
        expected = {isbn1: title1, isbn2: title2}

        index = isbn_index.createIndex()
        isbn_index.recordBook(index, isbn1, title1)
        isbn_index.recordBook(index, isbn2, title2)

        self.assertDictEqual(index, expected)
        return