Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
aaaf404f
Commit
aaaf404f
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Regression test for skipUnchanged
parent
b1ba2c0a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_memoize.py
+18
-5
18 additions, 5 deletions
tests/test_memoize.py
with
18 additions
and
5 deletions
tests/test_memoize.py
+
18
−
5
View file @
aaaf404f
...
...
@@ -5,6 +5,7 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
collections
import
six
import
numpy
as
np
...
...
@@ -90,11 +91,7 @@ def test_skipUnchanged():
"""
"""
timesCalled
=
{
'
key1
'
:
0
,
'
key2
'
:
0
,
'
key3
'
:
0
,
}
timesCalled
=
collections
.
defaultdict
(
lambda
:
0
)
def
setter
(
name
,
value
):
timesCalled
[
name
]
=
timesCalled
[
name
]
+
1
...
...
@@ -165,6 +162,22 @@ def test_skipUnchanged():
assert
timesCalled
[
'
key2
'
]
==
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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment