From 7641a90c34c07621e813b1aa7060114074f2741b Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 22 Feb 2016 15:22:38 +0000 Subject: [PATCH] Add a test for TreeCache.__contains__ --- tests/metrics/test_metric.py | 3 +++ tests/util/test_treecache.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tests/metrics/test_metric.py b/tests/metrics/test_metric.py index f9e5e5af0..f3c1927ce 100644 --- a/tests/metrics/test_metric.py +++ b/tests/metrics/test_metric.py @@ -61,6 +61,9 @@ class CounterMetricTestCase(unittest.TestCase): 'vector{method="PUT"} 1', ]) + # Check that passing too few values errors + self.assertRaises(ValueError, counter.inc) + class CallbackMetricTestCase(unittest.TestCase): diff --git a/tests/util/test_treecache.py b/tests/util/test_treecache.py index bcc64422b..7ab578a18 100644 --- a/tests/util/test_treecache.py +++ b/tests/util/test_treecache.py @@ -77,3 +77,9 @@ class TreeCacheTestCase(unittest.TestCase): cache[("b",)] = "B" cache.clear() self.assertEquals(len(cache), 0) + + def test_contains(self): + cache = TreeCache() + cache[("a",)] = "A" + self.assertTrue(("a",) in cache) + self.assertFalse(("b",) in cache)