Beispiel #1
0
 def pagination_default(self):
     '''Default values should work'''
     self.assertEqual(pagination(), "1 ... 10")
Beispiel #2
0
 def pagination_negative_around_value_should_not_break(self):
     '''Negative around value should not break'''
     self.assertEqual(pagination(5, 10, 0, -1), "1 ... 10")
Beispiel #3
0
 def pagination_around_pages_adjacent_to_right_boundary_should_have_a_single_ellipsis(
         self):
     '''around_pages adjacent to right_boundary should have a single ellipsis'''
     self.assertEqual(pagination(7, 10, 2, 1), "1 2 ... 6 7 8 9 10")
Beispiel #4
0
 def pagination_negative_boundaries_value_should_not_break(self):
     '''Negative boundaries value should not break'''
     self.assertEqual(pagination(5, 10, -10, 1), "1 ... 4 5 6 ... 10")
Beispiel #5
0
 def pagination_high_around_value_should_not_break(self):
     '''High around value should not break'''
     self.assertEqual(pagination(5, 10, 0, 15), "1 2 3 4 5 6 7 8 9 10")
Beispiel #6
0
 def pagination_exercise_example_2(self):
     '''Values from exercise example 2 should work'''
     self.assertEqual(pagination(4, 10, 2, 2), "1 2 3 4 5 6 ... 9 10")
Beispiel #7
0
 def pagination_high_boundaries_value_should_not_break(self):
     '''High boundaries value should not break'''
     self.assertEqual(pagination(5, 10, 20, 0), "1 2 3 4 5 6 7 8 9 10")
Beispiel #8
0
 def pagination_exercise_example_1(self):
     '''Values from exercise example 1 should work'''
     self.assertEqual(pagination(4, 5, 1, 0), "1 ... 4 5")
Beispiel #9
0
 def pagination_total_pages_should_be_greater_than_0(self):
     '''Total pages should be greater than 0'''
     self.assertEqual(pagination(5, -10, 0, 0),
                      "Total pages should be greater than 0")
Beispiel #10
0
 def pagination_current_page_should_be_greater_than_0(self):
     '''Current page should be greater than 0'''
     self.assertEqual(pagination(-5, 2, 0, 0),
                      "Current page should be greater than 0")
Beispiel #11
0
 def pagination_current_page_should_not_exceeed_total_number_of_pages(self):
     '''Current page should not exceed total number of pages'''
     self.assertEqual(pagination(5, 2, 0, 0),
                      "Current page exceeds total number of pages")
Beispiel #12
0
from footer import pagination

print("Advertio footer pagination exercise:")
print("\nExercise example 1")
print(pagination(4, 5, 1, 0))

print("\nExercise example 2")
print(pagination(4, 10, 2, 2))