def test_list_gen_start_at_zero():
    gen = IdListGenerator()
    assert gen.get_id() == 0
def test_list_gen_does_not_return_twice_the_same_value():
    gen = IdListGenerator()
    pid0 = gen.get_id()
    assert gen.get_id() != pid0
def test_list_gen_clear_restart_from_zero():
    gen = IdListGenerator()
    pid0 = gen.get_id(12)
    gen.clear()
    assert gen.get_id() == 0
    assert gen.get_id(pid0) == pid0
def test_list_gen_release_id_raise_error_if_id_not_used_already():
    gen = IdListGenerator()
    gen.get_id(16)
    assert_raises(IndexError, lambda: gen.release_id(20))
    assert_raises(IndexError, lambda: gen.release_id(0))
def test_list_gen_release_id_render_it_available():
    gen = IdListGenerator()
    pid = gen.get_id(16)
    gen.release_id(pid)
    assert gen.get_id(pid) == pid
def test_list_gen_returns_available_ids():
    gen = IdListGenerator()
    pid = gen.get_id(10)
    assert gen.get_id() < pid
def test_list_gen_raise_error_if_asked_twice_for_the_same_id():
    gen = IdListGenerator()
    gen.get_id(10)
    assert_raises(IndexError, lambda: gen.get_id(10))