You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to test that a null value can be returned within a list from a process, it appears that nf-test is dropping the null values from the list. I've created the following example to demonstrate the problem:
main.nf
include { return_null } from './return_null.nf'
workflow {
return_null | view { it }
}
return_null.nf
process return_null {
output:
val null_list, emit: null_list
exec:
null_list = ["0", "1", "", null, "4"]
}
return_null.nf.test
nextflow_process {
name "Test Process return_null"
script "return_null.nf"
process "return_null"
test("Should run without failures") {
when {
params {}
process {}
}
then {
assert process.success
with(process.out) {
assert null_list == [["0", "1", "", null, "4"]]
}
}
}
}
Nextflow seems to support this behaviour:
$ nextflow run main.nf
N E X T F L O W ~ version 23.04.3
Launching `main.nf` [agitated_kimura] DSL2 - revision: 7bdd792613
executor > local (1)
[dd/20ca57] process > return_null [100%] 1 of 1 ✔
[0, 1, , null, 4]
However, nf-test does not seem to support it:
$ nf-test test
🚀 nf-test 0.8.2
https://code.askimed.com/nf-test
(c) 2021 - 2023 Lukas Forer and Sebastian Schoenherr
Found 1 files in test directory.
Test Process return_null
Test [36f973af] 'Should run without failures' FAILED (3.857s)
Assertion failed:
assert null_list == [["0", "1", "", null, "4"]]
| |
| false
[['0', '1', '', '4']]
Nextflow stdout:
Nextflow stderr:
FAILURE: Executed 1 tests in 3.862s (1 failed)
I'm not familiar with the nf-test project, but I dug around a bit, and my best guess is that during JSON serialization of the channel (here), a JsonGenerator object is used with the .excludeNulls() option set (here). The corresponding outputs in meta/output_0.json and meta/output_null_list.json have the null item missing, so it seems to be related to serialization:
{"null_list":[["0","1","","4"]]}
Anyways, I'm not sure what the expected behaviour for nf-test is supposed to be, but I thought I would mention it here, since it seems to be different than Nextflow.
The text was updated successfully, but these errors were encountered:
When I try to test that a null value can be returned within a list from a process, it appears that nf-test is dropping the null values from the list. I've created the following example to demonstrate the problem:
main.nf
return_null.nf
return_null.nf.test
Nextflow seems to support this behaviour:
However, nf-test does not seem to support it:
I'm not familiar with the nf-test project, but I dug around a bit, and my best guess is that during JSON serialization of the channel (here), a
JsonGenerator
object is used with the.excludeNulls()
option set (here). The corresponding outputs inmeta/output_0.json
andmeta/output_null_list.json
have the null item missing, so it seems to be related to serialization:Anyways, I'm not sure what the expected behaviour for nf-test is supposed to be, but I thought I would mention it here, since it seems to be different than Nextflow.
The text was updated successfully, but these errors were encountered: