Add missing type hints to test.util.caches (#14529)

This commit is contained in:
Patrick Cloke 2022-11-22 17:35:54 -05:00 committed by GitHub
parent 7f78b383ca
commit 4ae967cf63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 66 deletions

View file

@ -20,11 +20,11 @@ from tests import unittest
class CacheTestCase(unittest.TestCase):
def setUp(self):
def setUp(self) -> None:
self.mock_timer = Mock(side_effect=lambda: 100.0)
self.cache = TTLCache("test_cache", self.mock_timer)
self.cache: TTLCache[str, str] = TTLCache("test_cache", self.mock_timer)
def test_get(self):
def test_get(self) -> None:
"""simple set/get tests"""
self.cache.set("one", "1", 10)
self.cache.set("two", "2", 20)
@ -59,7 +59,7 @@ class CacheTestCase(unittest.TestCase):
self.assertEqual(self.cache._metrics.hits, 4)
self.assertEqual(self.cache._metrics.misses, 5)
def test_expiry(self):
def test_expiry(self) -> None:
self.cache.set("one", "1", 10)
self.cache.set("two", "2", 20)
self.cache.set("three", "3", 30)