Skip to content
Snippets Groups Projects
Commit aaaf404f authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Regression test for skipUnchanged

parent b1ba2c0a
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com> # Author: Paul McCarthy <pauldmccarthy@gmail.com>
# #
import collections
import six import six
import numpy as np import numpy as np
...@@ -90,11 +91,7 @@ def test_skipUnchanged(): ...@@ -90,11 +91,7 @@ def test_skipUnchanged():
""" """
""" """
timesCalled = { timesCalled = collections.defaultdict(lambda: 0)
'key1' : 0,
'key2' : 0,
'key3' : 0,
}
def setter(name, value): def setter(name, value):
timesCalled[name] = timesCalled[name] + 1 timesCalled[name] = timesCalled[name] + 1
...@@ -165,6 +162,22 @@ def test_skipUnchanged(): ...@@ -165,6 +162,22 @@ def test_skipUnchanged():
assert timesCalled['key2'] == 5 assert timesCalled['key2'] == 5
assert timesCalled['key3'] == 5 assert timesCalled['key3'] == 5
# Regression - zero
# sized numpy arrays
# could previously be
# tested incorrectly
# because e.g.
#
# np.all(np.zeros((0, 3)), np.ones((1, 3))
#
# evaluates to True
wrapped('key4', np.zeros((0, 4)))
assert timesCalled['key4'] == 1
wrapped('key4', np.zeros((1, 4)))
assert timesCalled['key4'] == 2
def test_Instanceify(): def test_Instanceify():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment