from math import ceil


class PhotoAlbum:
    def __init__(self, pages):
        self.pages = pages
        self.photos = [[] for i in range(self.pages)]

    @classmethod
    def from_photos_count(cls, photos_count):
        count_pages = ceil(photos_count / 4)
        return cls(count_pages)
    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return f"{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}"
        return "No more free spots"

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append("-----------")
            new_photo.append(" ".join(["[]" for _ in range(len(row))]))

        return "\n".join(new_photo) + "\n" + "-----------" + "\n"


import unittest


class TestsPhotoAlbum(unittest.TestCase):
    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        result = album.add_photo("prom")
        self.assertEqual(result, "No more free spots")

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        self.assertEqual(album.photos, [['baby', 'first grade', 'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        result = album.display()
        self.assertEqual(result, "-----------\n[] [] [] []\n-----------\n")

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo("asdf")
        result = album.display()
        self.assertEqual(result, "-----------\n[] [] [] []\n-----------\n[] [] [] []\n-----------\n\n-----------\n")



if __name__ == "__main__":
    unittest.main()

cdbaa4c3ac7173ab99d6963a41031ed514b899f7
<mask token>


class PhotoAlbum:
    <mask token>
    <mask token>

    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return (
                    f'{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}'
                    )
        return 'No more free spots'

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append('-----------')
            new_photo.append(' '.join(['[]' for _ in range(len(row))]))
        return '\n'.join(new_photo) + '\n' + '-----------' + '\n'


<mask token>


class TestsPhotoAlbum(unittest.TestCase):

    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.add_photo('prom')
        self.assertEqual(result, 'No more free spots')

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        self.assertEqual(album.photos, [['baby', 'first grade',
            'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.display()
        self.assertEqual(result, '-----------\n[] [] [] []\n-----------\n')

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo('asdf')
        result = album.display()
        self.assertEqual(result,
            """-----------
[] [] [] []
-----------
[] [] [] []
-----------

-----------
"""
            )


<mask token>

<mask token>


class PhotoAlbum:
    <mask token>

    @classmethod
    def from_photos_count(cls, photos_count):
        count_pages = ceil(photos_count / 4)
        return cls(count_pages)

    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return (
                    f'{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}'
                    )
        return 'No more free spots'

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append('-----------')
            new_photo.append(' '.join(['[]' for _ in range(len(row))]))
        return '\n'.join(new_photo) + '\n' + '-----------' + '\n'


<mask token>


class TestsPhotoAlbum(unittest.TestCase):

    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.add_photo('prom')
        self.assertEqual(result, 'No more free spots')

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        self.assertEqual(album.photos, [['baby', 'first grade',
            'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.display()
        self.assertEqual(result, '-----------\n[] [] [] []\n-----------\n')

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo('asdf')
        result = album.display()
        self.assertEqual(result,
            """-----------
[] [] [] []
-----------
[] [] [] []
-----------

-----------
"""
            )


<mask token>

<mask token>


class PhotoAlbum:

    def __init__(self, pages):
        self.pages = pages
        self.photos = [[] for i in range(self.pages)]

    @classmethod
    def from_photos_count(cls, photos_count):
        count_pages = ceil(photos_count / 4)
        return cls(count_pages)

    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return (
                    f'{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}'
                    )
        return 'No more free spots'

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append('-----------')
            new_photo.append(' '.join(['[]' for _ in range(len(row))]))
        return '\n'.join(new_photo) + '\n' + '-----------' + '\n'


<mask token>


class TestsPhotoAlbum(unittest.TestCase):

    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.add_photo('prom')
        self.assertEqual(result, 'No more free spots')

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        self.assertEqual(album.photos, [['baby', 'first grade',
            'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.display()
        self.assertEqual(result, '-----------\n[] [] [] []\n-----------\n')

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo('asdf')
        result = album.display()
        self.assertEqual(result,
            """-----------
[] [] [] []
-----------
[] [] [] []
-----------

-----------
"""
            )


if __name__ == '__main__':
    unittest.main()

from math import ceil


class PhotoAlbum:

    def __init__(self, pages):
        self.pages = pages
        self.photos = [[] for i in range(self.pages)]

    @classmethod
    def from_photos_count(cls, photos_count):
        count_pages = ceil(photos_count / 4)
        return cls(count_pages)

    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return (
                    f'{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}'
                    )
        return 'No more free spots'

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append('-----------')
            new_photo.append(' '.join(['[]' for _ in range(len(row))]))
        return '\n'.join(new_photo) + '\n' + '-----------' + '\n'


import unittest


class TestsPhotoAlbum(unittest.TestCase):

    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.add_photo('prom')
        self.assertEqual(result, 'No more free spots')

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        self.assertEqual(album.photos, [['baby', 'first grade',
            'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo('baby')
        album.add_photo('first grade')
        album.add_photo('eight grade')
        album.add_photo('party with friends')
        result = album.display()
        self.assertEqual(result, '-----------\n[] [] [] []\n-----------\n')

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo('asdf')
        result = album.display()
        self.assertEqual(result,
            """-----------
[] [] [] []
-----------
[] [] [] []
-----------

-----------
"""
            )


if __name__ == '__main__':
    unittest.main()

from math import ceil


class PhotoAlbum:
    def __init__(self, pages):
        self.pages = pages
        self.photos = [[] for i in range(self.pages)]

    @classmethod
    def from_photos_count(cls, photos_count):
        count_pages = ceil(photos_count / 4)
        return cls(count_pages)
    def add_photo(self, label):
        for i in range(len(self.photos)):
            if len(self.photos[i]) < 4:
                self.photos[i].append(label)
                return f"{label} photo added successfully on page {i + 1} slot {len(self.photos[i])}"
        return "No more free spots"

    def display(self):
        new_photo = []
        for row in self.photos:
            new_photo.append("-----------")
            new_photo.append(" ".join(["[]" for _ in range(len(row))]))

        return "\n".join(new_photo) + "\n" + "-----------" + "\n"


import unittest


class TestsPhotoAlbum(unittest.TestCase):
    def test_init_creates_all_attributes(self):
        album = PhotoAlbum(2)
        self.assertEqual(album.pages, 2)
        self.assertEqual(album.photos, [[], []])

    def test_from_photos_should_create_instace(self):
        album = PhotoAlbum.from_photos_count(12)
        self.assertEqual(album.pages, 3)
        self.assertEqual(album.photos, [[], [], []])

    def test_add_photo_with_no_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        result = album.add_photo("prom")
        self.assertEqual(result, "No more free spots")

    def test_add_photo_with_free_spots(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        self.assertEqual(album.photos, [['baby', 'first grade', 'eight grade', 'party with friends']])

    def test_display_with_one_page(self):
        album = PhotoAlbum(1)
        album.add_photo("baby")
        album.add_photo("first grade")
        album.add_photo("eight grade")
        album.add_photo("party with friends")
        result = album.display()
        self.assertEqual(result, "-----------\n[] [] [] []\n-----------\n")

    def test_display_with_three_pages(self):
        album = PhotoAlbum(3)
        for _ in range(8):
            album.add_photo("asdf")
        result = album.display()
        self.assertEqual(result, "-----------\n[] [] [] []\n-----------\n[] [] [] []\n-----------\n\n-----------\n")



if __name__ == "__main__":
    unittest.main()
