Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
fslpy
Commits
5a9b8fee
Commit
5a9b8fee
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Expand naninfrange test to cover weird data
parent
52e5a60b
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_naninfrange.py
+41
-0
41 additions, 0 deletions
tests/test_naninfrange.py
with
41 additions
and
0 deletions
tests/test_naninfrange.py
+
41
−
0
View file @
5a9b8fee
...
...
@@ -50,3 +50,44 @@ def test_naninfrange():
if
np
.
isfinite
(
expected
[
1
]):
assert
result
[
1
]
==
expected
[
1
]
elif
np
.
isnan
(
expected
[
1
]):
assert
np
.
isnan
(
result
[
1
])
elif
np
.
isinf
(
expected
[
1
]):
assert
np
.
isinf
(
result
[
1
])
def
test_naninfrange_structured_ordered_contiguous
():
data
=
np
.
random
.
random
((
4
,
5
,
6
))
cdata
=
data
.
copy
(
order
=
'
C
'
)
fdata
=
data
.
copy
(
order
=
'
F
'
)
sdtype
=
np
.
dtype
([(
'
R
'
,
'
float64
'
),
(
'
G
'
,
'
float64
'
),
(
'
B
'
,
'
float64
'
)])
sdata
=
np
.
zeros
(
data
.
shape
,
dtype
=
sdtype
)
sdata
[
'
R
'
]
=
data
sdata
[
'
G
'
]
=
data
sdata
[
'
B
'
]
=
data
csdata
=
sdata
.
copy
(
order
=
'
C
'
)
fsdata
=
sdata
.
copy
(
order
=
'
F
'
)
tests
=
[
cdata
,
cdata
.
transpose
(
1
,
0
,
2
),
cdata
[
2
:
4
,
1
:
3
,
0
:
4
],
fdata
,
fdata
.
transpose
(
1
,
0
,
2
),
fdata
[
2
:
4
,
1
:
3
,
0
:
4
],
csdata
,
csdata
.
transpose
(
1
,
0
,
2
),
csdata
[
2
:
4
,
1
:
3
,
0
:
4
],
fsdata
,
fsdata
.
transpose
(
1
,
0
,
2
),
fsdata
[
2
:
4
,
1
:
3
,
0
:
4
]
]
for
t
in
tests
:
if
len
(
t
.
dtype
)
>
0
:
expmin
=
np
.
min
([
t
[
n
].
min
()
for
n
in
t
.
dtype
.
names
])
expmax
=
np
.
max
([
t
[
n
].
max
()
for
n
in
t
.
dtype
.
names
])
else
:
expmin
,
expmax
=
np
.
min
(
t
),
np
.
max
(
t
)
result
=
naninfrange
.
naninfrange
(
t
)
assert
np
.
all
(
np
.
isclose
(
result
,
(
expmin
,
expmax
)))
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