()
| 373 | |
| 374 | #[test] |
| 375 | fn check_model_dir_sharded_complete() { |
| 376 | let tmp = tempfile::tempdir().unwrap(); |
| 377 | fs::write(tmp.path().join("config.json"), "{}").unwrap(); |
| 378 | let index = serde_json::json!({ |
| 379 | "weight_map": { |
| 380 | "layer.0.weight": "shard-00001.safetensors", |
| 381 | "layer.1.weight": "shard-00002.safetensors" |
| 382 | } |
| 383 | }); |
| 384 | fs::write( |
| 385 | tmp.path().join("model.safetensors.index.json"), |
| 386 | serde_json::to_string(&index).unwrap(), |
| 387 | ) |
| 388 | .unwrap(); |
| 389 | fs::write(tmp.path().join("shard-00001.safetensors"), "data1").unwrap(); |
| 390 | fs::write(tmp.path().join("shard-00002.safetensors"), "data2").unwrap(); |
| 391 | |
| 392 | let result = check_model_dir(tmp.path()); |
| 393 | assert!(result.is_some()); |
| 394 | let (status, _size) = result.unwrap(); |
| 395 | assert_eq!(status, ModelStatus::Complete); |
| 396 | } |
| 397 | |
| 398 | #[test] |
| 399 | fn check_model_dir_sharded_missing_shard() { |
nothing calls this directly
no test coverage detected