-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fixing the bug of update_ methods #2208
Conversation
Test Plan: Currently in production, the following code throws an error. On this feature branch however it works as expected. fig = go.Figure()
fig.add_trace(go.Scatter(
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[0, 1, 3, 2, 4, 3, 4, 6, 5]
))
fig.update_layout(
showlegend=False,
annotations=[
dict(
x=2,
y=5,
xref="x",
yref="y",
text="dict Text",
showarrow=True,
arrowhead=7,
ax=0,
ay=-40
)
]
)
fig.update_annotations(text='changed')
fig.show() Changes look good! 💃 |
Thank you Mahdis and thank you Joe for the test idea. Since there is already a test class in |
The tests added by @Mahdis-z added pass, which is awesome! The relevant
I only have one suggestion. When I try to run
Therefore, wouldn't it be safer to update a property in the object (such as |
@jdamiba you mean using this branch but outside of pytest? This could also explain why the CI build using nosetests fails, but then I don't understand why pytest does not raise an error... Anyway yes in the test a property of the object should be used. |
Also, black is not happy (@Mahdis-z do you know how to use black? ping me otherwise) |
@jdamiba @emmanuelle Thanks for the review and comments 👍 not sure what am I missing that black is still unhappy |
Did you run black on |
It is not obvious to me why the The error is the one that this PR supposed to address:
@emma Any ideas why this particular container is failing but not any others? |
Not really. This build is using |
Does that CI job use the latest release and not master or something? |
could be, but then it would have happened with previous bug fixes adding tests... Taking a look right now. |
So the tests as written I don't think are actually running updates on a figure which contains a shape/annotation/image, which is why |
maybe this would even fix the nosetests problem ? |
@Mahdis-z for example do
so that there is already an annotation |
So I'm really having a hard time understanding what's going on here. I ran a few tests printing stuff in #2216 and it seems that the function signature is indeed the old one (with What I suggest is
|
@@ -219,6 +219,10 @@ def test_update_annotations(self): | |||
"annotations", [4], patch=dict(showarrow=False), secondary_y=True | |||
) | |||
|
|||
def test_annotation_attributes(self): | |||
self.fig.add_annotation(test="this text", yref="paper") |
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 think you wanted text="this text"
here. (CI fails because test
is not valid)
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.
ohh yep!
OK I think I know why this is happening... the files you've edited are actually the output of the code generation, so you also need to edit the codegen system so that the next time codegen is run, the changes are applied. Basically you need to add the |
ok, so when the codegen is changed, the procedure is normally to
But here you modified manually the |
I'm trying the codegen now to make sure it matches the mods here. |
Looks clean! Still waiting for 💚 |
Perfect! thx |
resolves #2167