New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] make cell_response.write more robust #456
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ def test_cell_response(tmpdir): | |
empty_spike = CellResponse(spike_times=[[], []], spike_gids=[[], []], | ||
spike_types=[[], []]) | ||
empty_spike.write(tmpdir.join('empty_spk_%d.txt')) | ||
empty_spike.write(tmpdir.join('empty_spk.txt')) | ||
empty_spike.write(tmpdir.join('empty_spk_{0}.txt')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this overwrite the files? Then L49 is only testing the previous line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah the others are smoke tests |
||
assert empty_spike == read_spikes(tmpdir.join('empty_spk_*.txt')) | ||
|
||
assert ("CellResponse | 2 simulation trials" in repr(empty_spike)) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it is now impossible for a user to specify a filename without a trial number contained somewhere in it? I get that this prevents the user from accidentally overwriting multiples trials, however, I'm not sure how I feel about automatically modifying user input. Feel free to override this opinion as I see a valid argument either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not possible before this PR also. This PR just automatically appends a trial number if the user doesn't specify it. Other option is to throw an explicit error (as opposed to the cryptic error we get now) if the user provides a filename without a format specifier when there are multiple trials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards the explicit error being best. Especially since you're writing the full file name
'blah.txt'
as opposed to a generic name with no'.txt'
at the end.I think it'd be ok if the user use provided
'filenamehere'
and then the'_1.txt'
was appended automatically.