(self)
| 82 | assert env.get_template("foo") is not env.get_template("foo") |
| 83 | |
| 84 | def test_limited_size_cache(self): |
| 85 | mapping = {"one": "foo", "two": "bar", "three": "baz"} |
| 86 | loader = loaders.DictLoader(mapping) |
| 87 | env = Environment(loader=loader, cache_size=2) |
| 88 | t1 = env.get_template("one") |
| 89 | t2 = env.get_template("two") |
| 90 | assert t2 is env.get_template("two") |
| 91 | assert t1 is env.get_template("one") |
| 92 | env.get_template("three") |
| 93 | loader_ref = weakref.ref(loader) |
| 94 | assert (loader_ref, "one") in env.cache |
| 95 | assert (loader_ref, "two") not in env.cache |
| 96 | assert (loader_ref, "three") in env.cache |
| 97 | |
| 98 | def test_cache_loader_change(self): |
| 99 | loader1 = loaders.DictLoader({"foo": "one"}) |
nothing calls this directly
no test coverage detected