Пример #1
0
def test_target_widths_328_4087():
    idx_of_328, idx_of_4087 = 8, -5
    expected = constants.SRCSET_TARGET_WIDTHS[idx_of_328:idx_of_4087]
    actual = urlbuilder.target_widths(start=328, stop=4087)
    assert len(actual) == len(expected)
    assert actual[0] == expected[0]
    assert actual[-1] == expected[-1]
Пример #2
0
def test_target_widths_100_max():
    idx_of_100 = constants.SRCSET_TARGET_WIDTHS[0]
    idx_of_8192 = constants.SRCSET_TARGET_WIDTHS[-1]
    expected = [idx_of_100, idx_of_8192]
    actual = urlbuilder.target_widths(tol=10000000000)
    assert actual == expected
    assert actual[0] == IMAGE_MIN_WIDTH
    assert actual[-1] == IMAGE_MAX_WIDTH
Пример #3
0
def test_target_widths_328_to_328():
    expected = [328]
    actual = urlbuilder.target_widths(start=328, stop=328)
    assert actual == expected
Пример #4
0
def test_target_widths_100_7401():
    idx_of_7401 = -1
    expected = constants.SRCSET_TARGET_WIDTHS[:idx_of_7401]
    actual = urlbuilder.target_widths(start=100, stop=7401)
    assert actual == expected
Пример #5
0
def test_target_widths_default():
    expected = constants.SRCSET_TARGET_WIDTHS
    actual = urlbuilder.target_widths()
    assert len(actual) == len(expected)
    assert actual == expected