def test_group_books_to_set_1book(self): """ 第一集一本,組成:一本書 """ # arrange books = { POTTER_VOL_1: 1, } # act booksets = BookSet.group_books_to_set(books) # assert expected = [ BookSet({POTTER_VOL_1}), ] self.assertListEqual(booksets, expected)
def test_group_books_to_set_2books(self): """ 一二集各一本,組成:兩本套書 """ # arrange books = { POTTER_VOL_1: 1, POTTER_VOL_2: 1, } # act booksets = BookSet.group_books_to_set(books) # assert expected = [ BookSet({POTTER_VOL_1, POTTER_VOL_2}), ] self.assertListEqual(booksets, expected)
def test_group_books_to_set_3books_and_2books(self): """ 第一集一本,第二三集各兩本,組成:三本套書+兩本套書 """ # arrange books = { POTTER_VOL_1: 1, POTTER_VOL_2: 2, POTTER_VOL_3: 2, } # act booksets = BookSet.group_books_to_set(books) # assert expected = [ BookSet({POTTER_VOL_1, POTTER_VOL_2, POTTER_VOL_3}), BookSet({POTTER_VOL_2, POTTER_VOL_3}), ] self.assertListEqual(booksets, expected)
def test_group_books_to_set_3books_and_1book(self): """ 一二集各一本,第三集兩本,組成:三本套書+一本書 """ # arrange books = { POTTER_VOL_1: 1, POTTER_VOL_2: 1, POTTER_VOL_3: 2, } # act booksets = BookSet.group_books_to_set(books) # assert expected = [ BookSet({POTTER_VOL_1, POTTER_VOL_2, POTTER_VOL_3}), BookSet({POTTER_VOL_3}), ] self.assertListEqual(booksets, expected)
def test_group_books_to_set_5books(self): """ 一二三四五集各一本,組成:五本套書 """ # arrange books = { POTTER_VOL_1: 1, POTTER_VOL_2: 1, POTTER_VOL_3: 1, POTTER_VOL_4: 1, POTTER_VOL_5: 1, } # act booksets = BookSet.group_books_to_set(books) # assert expected = [ BookSet({POTTER_VOL_1, POTTER_VOL_2, POTTER_VOL_3, POTTER_VOL_4, POTTER_VOL_5}), ] self.assertListEqual(booksets, expected)