Example #1
0
def test_build_title_with_page_numbers_last():
    src_title = 'Title'
    expected_title = 'Title\n### Page 4/4'
    count = 100
    limit = 30
    offset = 75

    # start of last page
    assert expected_title == build_title_with_page_numbers(
        src_title, count, limit, offset)

    offset = 101
    assert expected_title == build_title_with_page_numbers(
        src_title, count, limit, offset)
Example #2
0
def test_build_title_with_page_numbers_start():
    src_title = 'Title'
    expected_title = 'Title\n### Page 1/4'
    count = 100
    limit = 30
    offset = 0

    # start of first page
    assert expected_title == build_title_with_page_numbers(
        src_title, count, limit, offset)

    # end of first page
    offset = 24
    assert expected_title == build_title_with_page_numbers(
        src_title, count, limit, offset)
Example #3
0
def test_build_title_with_page_numbers_zero_div():
    src_title = 'Title'
    count = 0
    limit = 30
    offset = 0
    assert src_title == build_title_with_page_numbers(src_title, count, limit,
                                                      offset)
Example #4
0
def test_build_title_with_page_numbers_wrong_type():
    src_title = 'Title'
    count = '100'
    limit = 30
    offset = 0
    # count of wrong type
    assert src_title == build_title_with_page_numbers(src_title, count, limit,
                                                      offset)

    # limit of wrong type
    count = 100
    limit = '30'
    assert src_title == build_title_with_page_numbers(src_title, count, limit,
                                                      offset)

    # offset of wrong type
    limit = 30
    offset = '0'
    assert src_title == build_title_with_page_numbers(src_title, count, limit,
                                                      offset)