def test_set_prevents_get_with_different_path(): """Ensure an object stored with set only matches one patch.""" cache = ModuleCache() module = object() name = 'test' path = '/some/path/to/test' cache.set(name=name, path=path, module=module) assert cache.get(name=name, path=path + '/notsame') is not module
def test_set_allows_get_with_same_path(): """Ensure an object stored with set is available via get.""" cache = ModuleCache() module = object() name = 'test' path = '/some/path/to/test' cache.set(name=name, path=path, module=module) assert cache.get(name=name, path=path) is module