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
28752e9e
Commit
28752e9e
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test makeWriteable
parent
9a6a98f8
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_fsl_data_utils.py
+21
-0
21 additions, 0 deletions
tests/test_fsl_data_utils.py
with
21 additions
and
0 deletions
tests/test_fsl_data_utils.py
+
21
−
0
View file @
28752e9e
...
...
@@ -9,6 +9,8 @@ import shutil
import
os
import
os.path
as
op
import
numpy
as
np
import
fsl.utils.tempdir
as
tempdir
import
fsl.data.utils
as
dutils
...
...
@@ -105,3 +107,22 @@ def test_guessType():
asrt
(
'
norecognise.txt
'
,
None
)
os
.
remove
(
'
norecognise
'
)
os
.
remove
(
'
norecognise.txt
'
)
def
test_makeWriteable
():
robuf
=
bytes
(
b
'
\01\02\03\04
'
)
wbuf
=
bytearray
(
b
'
\01\02\03\04
'
)
roarr
=
np
.
ndarray
((
4
,),
dtype
=
np
.
uint8
,
buffer
=
robuf
)
warr
=
np
.
ndarray
((
4
,),
dtype
=
np
.
uint8
,
buffer
=
wbuf
)
warr
.
flags
[
'
WRITEABLE
'
]
=
False
rocopy
=
dutils
.
makeWriteable
(
roarr
)
wcopy
=
dutils
.
makeWriteable
(
warr
)
assert
rocopy
.
base
is
not
roarr
.
base
assert
wcopy
.
base
is
warr
.
base
rocopy
[
1
]
=
100
wcopy
[
1
]
=
100
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