()
| 265 | |
| 266 | #[test] |
| 267 | fn find_cached_model_complete_single() { |
| 268 | let _lock = ENV_LOCK.lock().unwrap(); |
| 269 | let tmp = tempfile::tempdir().unwrap(); |
| 270 | let cache = tmp.path(); |
| 271 | std::env::set_var("HF_HUB_CACHE", cache.to_str().unwrap()); |
| 272 | |
| 273 | let snap = cache |
| 274 | .join("models--test--model") |
| 275 | .join("snapshots") |
| 276 | .join("abc123"); |
| 277 | fs::create_dir_all(&snap).unwrap(); |
| 278 | fs::write(snap.join("config.json"), "{}").unwrap(); |
| 279 | fs::write(snap.join("model.safetensors"), "data").unwrap(); |
| 280 | |
| 281 | let result = find_cached_model("test/model"); |
| 282 | assert_eq!(result, Some(snap)); |
| 283 | |
| 284 | std::env::remove_var("HF_HUB_CACHE"); |
| 285 | } |
| 286 | |
| 287 | #[test] |
| 288 | fn find_cached_model_complete_sharded() { |
nothing calls this directly
no test coverage detected