Skip to content

test : added pytest unit tests for prediction_cache module#1883

Open
tmdeveloper007 wants to merge 1 commit into
gopaljilab:mainfrom
tmdeveloper007:#1874
Open

test : added pytest unit tests for prediction_cache module#1883
tmdeveloper007 wants to merge 1 commit into
gopaljilab:mainfrom
tmdeveloper007:#1874

Conversation

@tmdeveloper007

@tmdeveloper007 tmdeveloper007 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

test : added pytest unit tests for prediction_cache module

Changes

Test coverage for the relevant module/middleware.

Impact

No production changes. Test coverage only.

Closes ##1874

Note

Assign to tmdeveloper007

- Test PredictionLRUCache.get() returns None for missing keys
- Test get() returns cached values and handles TTL expiration
- Test LRU ordering: accessing a key moves it to most-recently-used position
- Test TTL eviction with fake time injection
- Test TTL refresh when set() is called on existing key
- Test max_size LRU eviction of oldest entry
- Test stats() reports accurate hit/miss counts and hit_rate
- Test clear() empties the cache
- Test get_cache() returns the module-level singleton
@github-actions github-actions Bot added the type:testing Adding, updating, or fixing unit/integration tests. label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:testing Adding, updating, or fixing unit/integration tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant