count() should work the same as len(), but with the option to exclude expired responses
(self)
| 367 | assert session.cache.db_path == session.cache.responses.db_path |
| 368 | |
| 369 | def test_count(self): |
| 370 | """count() should work the same as len(), but with the option to exclude expired responses""" |
| 371 | session = self.init_session() |
| 372 | now = utcnow() |
| 373 | session.cache.responses['key_1'] = CachedResponse(expires=now + timedelta(1)) |
| 374 | session.cache.responses['key_2'] = CachedResponse(expires=now - timedelta(1)) |
| 375 | |
| 376 | assert session.cache.count() == 2 |
| 377 | assert session.cache.count(expired=False) == 1 |
| 378 | |
| 379 | def test_delete__single_key(self): |
| 380 | """Vacuum should not be used after delete if there is only a single key""" |
nothing calls this directly
no test coverage detected