Ejemplo n.º 1
0
def test_range_as_string():
    """Test range detection in a list of (string) integers."""
    years1 = ["1981", "1982", "1983"]
    years2 = ["1981", "1982", "1985"]
    years3 = ["1981", "1989", "1995"]
    years4 = ["1981", "1982", "1989", "2015", "2016"]
    years5 = [500, 501, 600]
    assert range_as_string(years1) == "1981-1983"
    assert range_as_string(years2) == "1981-1982, 1985"
    assert range_as_string(years3) == "1981, 1989, 1995"
    assert range_as_string(years4) == "1981-1982, 1989, 2015-2016"
    assert range_as_string(years5) == "500-501, 600"
Ejemplo n.º 2
0
def test_range_as_string():
    """Test range detection in a list of (string) integers."""
    years1 = ["1981", "1982", "1983"]
    years2 = ["1981", "1982", "1985"]
    years3 = ["1981", "1989", "1995"]
    years4 = ["1981", "1982", "1989", "2015", "2016"]
    years5 = [500, 501, 600]
    assert range_as_string(years1) == "1981-1983"
    assert range_as_string(years2) == "1981-1982, 1985"
    assert range_as_string(years3) == "1981, 1989, 1995"
    assert range_as_string(years4) == "1981-1982, 1989, 2015-2016"
    assert range_as_string(years5) == "500-501, 600"