def test_get_nearest_returns_parent_cache_if_found(): """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_nearest(name=name, path=path + '/notsame') is module