Download a sample TIFF and validate hash handling. Raises: RuntimeError: When the downloaded file's hash does not match.
(self)
| 193 | """Exercise ``download_url`` success and hash-mismatch paths.""" |
| 194 | |
| 195 | def test_download_url(self): |
| 196 | """Download a sample TIFF and validate hash handling. |
| 197 | |
| 198 | Raises: |
| 199 | RuntimeError: When the downloaded file's hash does not match. |
| 200 | """ |
| 201 | with tempfile.TemporaryDirectory() as tempdir: |
| 202 | with skip_if_downloading_fails(): |
| 203 | download_url( |
| 204 | url=SAMPLE_TIFF, |
| 205 | filepath=os.path.join(tempdir, "model.tiff"), |
| 206 | hash_val=SAMPLE_TIFF_HASH, |
| 207 | hash_type=SAMPLE_TIFF_HASH_TYPE, |
| 208 | ) |
| 209 | with self.assertRaises(RuntimeError): |
| 210 | download_url( |
| 211 | url=SAMPLE_TIFF, |
| 212 | filepath=os.path.join(tempdir, "model_bad.tiff"), |
| 213 | hash_val="0" * 64, |
| 214 | hash_type=SAMPLE_TIFF_HASH_TYPE, |
| 215 | ) |
| 216 | |
| 217 | |
| 218 | def test_pretrained_networks(network, input_param, device): |
nothing calls this directly
no test coverage detected