Test cache statistics functionality.
(self)
| 345 | self.assertFalse(result, "Convenience function should work correctly") |
| 346 | |
| 347 | def test_cache_stats(self) -> None: |
| 348 | """Test cache statistics functionality.""" |
| 349 | cache_file = self.cache_dir / "stats.json" |
| 350 | cache = FingerprintCache(cache_file) |
| 351 | |
| 352 | # Initially empty cache |
| 353 | stats = cache.get_cache_stats() |
| 354 | self.assertEqual(stats["total_entries"], 0) |
| 355 | self.assertFalse(stats["cache_file_exists"]) |
| 356 | |
| 357 | # Add some entries |
| 358 | test_file = self.temp_dir / "stats.txt" |
| 359 | self.create_test_file(test_file, "stats content") |
| 360 | cache.has_changed(test_file, time.time() - 1) |
| 361 | |
| 362 | # Check stats after entries |
| 363 | stats = cache.get_cache_stats() |
| 364 | self.assertEqual(stats["total_entries"], 1) |
| 365 | self.assertTrue(stats["cache_file_exists"]) |
| 366 | self.assertGreater(stats["cache_file_size_bytes"], 0) |
| 367 | |
| 368 | def test_clear_cache(self) -> None: |
| 369 | """Test cache clearing functionality.""" |
nothing calls this directly
no test coverage detected