From 43296f1f867af6be30366d6d35bed28fa42919c4 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Tue, 1 May 2018 18:11:44 +0100 Subject: [PATCH] TEST: Unit tests for skipUnchanged.invalidate --- tests/test_memoize.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_memoize.py b/tests/test_memoize.py index 9b885d0fd..386674659 100644 --- a/tests/test_memoize.py +++ b/tests/test_memoize.py @@ -242,7 +242,29 @@ def test_skipUnchanged(): wrapped('key4', np.zeros((1, 4))) assert timesCalled['key4'] == 2 + timesCalled['key1'] = 0 + timesCalled['key2'] = 0 + timesCalled['key3'] = 0 + wrapped('key1', 1) + wrapped('key2', 2) + wrapped('key3', 3) + assert timesCalled['key1'] == 1 + assert timesCalled['key2'] == 1 + assert timesCalled['key3'] == 1 + wrapped('key1', 1) + wrapped('key2', 2) + wrapped('key3', 3) + assert timesCalled['key1'] == 1 + assert timesCalled['key2'] == 1 + assert timesCalled['key3'] == 1 + wrapped.invalidate() + wrapped('key1', 1) + wrapped('key2', 2) + wrapped('key3', 3) + assert timesCalled['key1'] == 2 + assert timesCalled['key2'] == 2 + assert timesCalled['key3'] == 2 def test_Instanceify(): -- GitLab