8000 Error: float vs scientific notation in snapshots of csv files · Issue #291 · askimed/nf-test · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip t 8000 o content
Error: float vs scientific notation in snapshots of csv files #291
Open
@a-solovyev12

Description

@a-solovyev12

Hello,

I am using a snapshot of a specific output file to track exact changes when a test fails. The file is sorted to avoid errors based on row/column order. The following is used to generate a snapshot:
assert snapshot(path(process.out[0].get(0)).csv().sort()).match()

The resulting snapshot file contains information about the individual rows of an output file:

"rows": [
                    {
                        "prior.c": null,
                        "prior.1": 0.0025,
                        "bb.selection": "align",
                        "reg.thresh": null
                    },
                    {
                        "prior.c": 0.001,
                        "prior.1": null,
                        "bb.selection": "regional",
                        "reg.thresh": null
                    },
                    {
                        "prior.c": 1.0E-4,
                        "prior.1": null,
                        "bb.selection": "regional",
                        "reg.thresh": null
                    }, 
                    {
                        "prior.c": 1.0E-10,
                        "prior.1": null,
                        "bb.selection": "regional",
                        "reg.thresh": null
                    }
             ]

When running the test I am getting an error at the row with "prior.c": 1.0E-4, because at some point it gets converted from scientific notation into a float:

Test [d35e79b4] 'Runs without failures' java.lang.RuntimeException: Different Snapshot:
199c199
<                 "prior.c": 0.00010,
---
>                 "prior.c": 1.0E-4

Notably, I haven't observed such behaviour with other powers of 10 in scientific notation. Would it be possbile to add some checks to avoid such conversions? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0