def test_really_long_gen_cache_build_key():
    SUPER_LONG_STRING = "lorem" * 84
    SLIGHTLY_LONG_GEN = "anothergeneration222222222222222222222222222222222222222222222222222222222222222:gen"

    key = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", SLIGHTLY_LONG_GEN, SUPER_LONG_STRING, num=98, gen="anothergen"
    )
    key2 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", SLIGHTLY_LONG_GEN, SUPER_LONG_STRING, num=98, gen="anothergen"
    )
    eq_(key, key2)

    gen_cache.invalidate("myproject")
    key3 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", SLIGHTLY_LONG_GEN, SUPER_LONG_STRING, num=98, gen="anothergen"
    )
    ok_(key3 != key2)

    gen_cache.invalidate(SUPER_LONG_STRING)
    key4 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", SLIGHTLY_LONG_GEN, SUPER_LONG_STRING, num=98, gen="anothergen"
    )
    ok_(key4 != key3)

    gen_cache.invalidate(SLIGHTLY_LONG_GEN, gen="anothergen")
    key5 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", SLIGHTLY_LONG_GEN, SUPER_LONG_STRING, num=98, gen="anothergen"
    )
    ok_(key5 != key4)
def test_gen_cache_build_key():
    key = gen_cache.build_key("unittest", "myproject", "testnum:num", "anothergeneration:gen", num=98, gen="anothergen")
    key2 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", "anothergeneration:gen", num=98, gen="anothergen"
    )
    eq_(key, key2)

    gen_cache.invalidate("myproject")
    key3 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", "anothergeneration:gen", num=98, gen="anothergen"
    )
    ok_(key3 != key2)

    gen_cache.invalidate("testnum:num", num=98)
    key4 = gen_cache.build_key(
        "unittest", "myproject", "testnum:num", "anothergeneration:gen", num=98, gen="anothergen"
    )
    ok_(key3 != key4)