MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_cache_stats

Method test_cache_stats

ci/tests/test_fingerprint_cache.py:347–366  ·  view source on GitHub ↗

Test cache statistics functionality.

(self)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 5

get_cache_statsMethod · 0.95
create_test_fileMethod · 0.95
has_changedMethod · 0.95
FingerprintCacheClass · 0.90
timeMethod · 0.80

Tested by

no test coverage detected