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
Updated for #394 #396
Updated for #394 #396
Conversation
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.
A good way to do this is like so:
if(isTRUE(nzchar(n$InputFileName)))
file=basename(n$InputFileName)
else
stop("No file specified and neuron does not have an InputFileName")
tests/testthat/test-neuron-io.R
Outdated
y=Cell07PNs[[1]] | ||
td=tempfile() | ||
on.exit(unlink(td,recursive=TRUE)) | ||
if ("InputFileName" %in% names(y)){y["InputFileName"] <- NULL} |
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.
y$InputFileName
is the same as y[["InputFileName"]]
which is probably what you want.
tests/testthat/test-neuron-io.R
Outdated
test_that("we can write neuron/dotprops to rds file",{ | ||
x=kcs20[[1]] | ||
td=tempfile() | ||
on.exit(unlink(td,recursive=TRUE)) | ||
expect_error(f<-write.neuron(x, dir=td, MakeDir = F), 'does not exist') | ||
expect_equal(f<-write.neuron(x, dir=td), | ||
expect_equal(f<-write.neuron(x, dir=td, format = 'rds'), |
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.
roll that back.
tests/testthat/test-neuron-io.R
Outdated
dir.create(td) | ||
on.exit(unlink(td,recursive=TRUE)) | ||
#Try writing with default format | ||
expect_warning(f <- write.neuron(y, dir=td, MakeDir = F),'Defaulting format to swc') |
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.
could you maybe put this as the message: "write.neuron: using default format='swc'"
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.
Great!
Updated the check for InputFileName and added test cases for #394