Skip to content

Test mock with unexpected "barnorm" value #4704

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

Closed
hmf opened this issue Mar 28, 2020 · 4 comments
Closed

Test mock with unexpected "barnorm" value #4704

hmf opened this issue Mar 28, 2020 · 4 comments

Comments

@hmf
Copy link

hmf commented Mar 28, 2020

The mock bar_attrs_overlay.json has the following layout:

    "layout":{
        "xaxis": {"showgrid":true},
        "height":400,
        "width":400,
        "barmode":"overlay",
        "barnorm":false
    }

Testing based on the schema resulted in a parsing error of "barnorm". The schema has:

"barnorm": {
                    "valType": "enumerated",
                    "values": [
                        "",
                        "fraction",
                        "percent"
                    ],
                    "dflt": "",
                    "role": "info",
                    "editType": "calc",
                    "description": "Sets the normalization for bar traces on the graph. With *fraction*, the value of each bar is divided by the sum of all values at that location coordinate. *percent* is the same but multiplied by 100 to show percentages."
                },

Is that an error or can we have false values?

TIA

@hmf hmf changed the title Test mock with Test mock with unexpected "barnorm" value Mar 28, 2020
@archmoj
Copy link
Contributor

archmoj commented Mar 28, 2020

Some attributes could be set to false.
But in this case false is not among those valid options for barnorm.
So the dflt value would be used which is blank string ( "" ).

@hmf
Copy link
Author

hmf commented Mar 29, 2020

So I can consider this value incorrect? The reason I ask is explained in this
#4705 (comment).

Apologies for insisting so much but auto-generating code from the schema is not trivial for me.

@alexcjohnson
Copy link
Collaborator

That's an error, good catch! In fact, layout.barnorm isn't even used in that mock, because it has barmode: 'overlay'

if(mode !== 'overlay') coerce('barnorm');

So we should just remove that line from the mock.

@hmf
Copy link
Author

hmf commented Mar 30, 2020

Ok. I will set it to "" in my tests and update the mock to latest changes when available. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants