-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from NeurodataWithoutBorders/196-direct-objec…
…t-reference 196 direct object reference
- Loading branch information
Showing
41 changed files
with
740 additions
and
1,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,54 @@ | ||
classdef PyNWBIOTest < tests.system.RoundTripTest | ||
% Assumes PyNWB and unittest2 has been installed on the system. | ||
% | ||
% To install PyNWB, execute: | ||
% $ pip install pynwb | ||
% | ||
% To install unittest2, execute: | ||
% $ pip install unittest2 | ||
methods(Test) | ||
function testOutToPyNWB(testCase) | ||
filename = ['MatNWB.' testCase.className() '.testOutToPyNWB.nwb']; | ||
nwbExport(testCase.file, filename); | ||
[status, cmdout] = testCase.runPyTest('testInFromMatNWB'); | ||
if status | ||
testCase.verifyFail(cmdout); | ||
end | ||
% Assumes PyNWB and unittest2 has been installed on the system. | ||
% | ||
% To install PyNWB, execute: | ||
% $ pip install pynwb | ||
% | ||
% To install unittest2, execute: | ||
% $ pip install unittest2 | ||
methods(Test) | ||
function testOutToPyNWB(testCase) | ||
filename = ['MatNWB.' testCase.className() '.testOutToPyNWB.nwb']; | ||
nwbExport(testCase.file, filename); | ||
[status, cmdout] = testCase.runPyTest('testInFromMatNWB'); | ||
if status | ||
testCase.verifyFail(cmdout); | ||
end | ||
end | ||
|
||
function testInFromPyNWB(testCase) | ||
[status, cmdout] = testCase.runPyTest('testOutToMatNWB'); | ||
if status | ||
testCase.assertFail(cmdout); | ||
end | ||
filename = ['PyNWB.' testCase.className() '.testOutToMatNWB.nwb']; | ||
pyfile = nwbRead(filename); | ||
pycontainer = testCase.getContainer(pyfile); | ||
matcontainer = testCase.getContainer(testCase.file); | ||
nwbExport(testCase.file, 'temp.nwb'); % hack to fill out ObjectView container paths. | ||
% ignore file_create_date because nwbExport will actually | ||
% mutate the property every export. | ||
tests.util.verifyContainerEqual(testCase, pycontainer, matcontainer, {'file_create_date'}); | ||
end | ||
end | ||
|
||
function testInFromPyNWB(testCase) | ||
[status, cmdout] = testCase.runPyTest('testOutToMatNWB'); | ||
if status | ||
testCase.assertFail(cmdout); | ||
end | ||
filename = ['PyNWB.' testCase.className() '.testOutToMatNWB.nwb']; | ||
pyfile = nwbRead(filename); | ||
pycontainer = testCase.getContainer(pyfile); | ||
matcontainer = testCase.getContainer(testCase.file); | ||
testCase.verifyContainerEqual(pycontainer, matcontainer); | ||
methods | ||
function [status, cmdout] = runPyTest(testCase, testName) | ||
setenv('PYTHONPATH', fileparts(mfilename('fullpath'))); | ||
|
||
envPath = fullfile('+tests', 'env.mat'); | ||
if 2 == exist(envPath, 'file') | ||
Env = load(envPath, '-mat', 'pythonDir'); | ||
|
||
pythonPath = fullfile(Env.pythonDir, 'python'); | ||
else | ||
pythonPath = 'python'; | ||
end | ||
|
||
cmd = sprintf('"%s" -B -m unittest %s.%s.%s',... | ||
pythonPath,... | ||
'PyNWBIOTest', testCase.className(), testName); | ||
[status, cmdout] = system(cmd); | ||
end | ||
end | ||
end | ||
|
||
methods | ||
function [status, cmdout] = runPyTest(testCase, testName) | ||
setenv('PYTHONPATH', fileparts(mfilename('fullpath'))); | ||
|
||
envPath = fullfile('+tests', 'env.mat'); | ||
if 2 == exist(envPath, 'file') | ||
Env = load(envPath, '-mat', 'pythonDir'); | ||
|
||
pythonPath = fullfile(Env.pythonDir, 'python'); | ||
else | ||
pythonPath = 'python'; | ||
end | ||
|
||
cmd = sprintf('"%s" -B -m unittest %s.%s.%s',... | ||
pythonPath,... | ||
'PyNWBIOTest', testCase.className(), testName); | ||
[status, cmdout] = system(cmd); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.