Example #1
0
    def test_shown(self):
        pages = 50
        tests = [{'label': 'left edge', 'current': 0, 'expect': [[
            0,
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            ], [47, 48, 49]]}, {'label': 'middle', 'current': 25,
                                'expect': [[0, 1, 2], [
            20,
            21,
            22,
            23,
            24,
            25,
            26,
            27,
            28,
            29,
            ], [47, 48, 49]]}, {'label': 'right edge', 'current': 49,
                                'expect': [[0, 1, 2], [
            41,
            42,
            43,
            44,
            45,
            46,
            47,
            48,
            49,
            ]]}]

        for test in tests:
            page_list = PageList(pages, current_page=test['current'])
            self.assertEqual(page_list.shown(), test['expect'])
        return