-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Copy width/height calculating logic from kaleido #5325
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
base: main
Are you sure you want to change the base?
Conversation
closes plotly/Kaleido#378 |
Looks good @ayjayt ! Just run Let's add a test for this one. I'm happy to do that if you don't have the bandwidth, just let me know. |
Co-authored-by: Emily KL <[email protected]>
Co-authored-by: Emily KL <[email protected]>
@@ -314,3 +315,59 @@ def test_get_chrome(): | |||
|
|||
# Verify that kaleido.get_chrome_sync was called | |||
mock_get_chrome.assert_called_once() | |||
|
|||
|
|||
def create_figure(width=None, height=None): |
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.
nit: could you move these two utility functions to the top of the file so they're not mixed in with the test functions?
fig = create_figure() | ||
svg_bytes = pio.to_image(fig, format="svg") | ||
width, height = parse_svg_dimensions(svg_bytes) | ||
assert width is not None and height is not None, ( |
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.
You should be able to import pio.defaults
here and check that the dimensions equal the defaults
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.
Thanks @ayjayt ! 🚀
Code PR
plotly.graph_objects
, my modifications concern the code generator and not the generated files.plotly/Kaleido#378