Skip to content
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

Test fixes 2 #994

Merged
merged 28 commits into from
May 7, 2018
Merged

Test fixes 2 #994

merged 28 commits into from
May 7, 2018

Conversation

Kully
Copy link
Contributor

@Kully Kully commented Apr 23, 2018

Continuation of #975 (comment)

Fixing Minor Tests for Ipyplotly Integration PR

cc. @jmmease @chriddyp

@Kully Kully changed the base branch from master to ipyplotly_integration April 23, 2018 18:57
@Kully
Copy link
Contributor Author

Kully commented May 2, 2018

@jmmease @chriddyp
All tests should be finished!

For the streaming bit, I tweaked a few things in the code and would like some feedback. The main problem was that the validation path for Stream.write()was busted. If left on it was treating the dict to update the streaming info (eg.Scatter(x=[1], y=[2])`) like an attr of Plotly Figure.

To fix this I decided to just let the code do Jon's tight and immediate validation.

@@ -31,6 +31,7 @@
from plotly.api import v1, v2
from plotly.basedatatypes import BaseTraceType
from plotly.plotly import chunked_requests
from plotly.graph_objs import Scatter
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it create an issue to create a dependancy of graph_objs for plotly.py?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. There shouldn't be an existing dependency the other way (i.e. plotly.graph_objs -> plotly.plotly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good. I only brought it up because another engineer advised against doing that i.e. sent me an blogpost saying it could be a problem

@@ -588,7 +588,7 @@ def open(self):
streaming_specs = self.get_streaming_specs()
self._stream = chunked_requests.Stream(**streaming_specs)

def write(self, trace, layout=None, validate=True,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed validate so that users will not be able to use the internal validation


stream_object = dict()
stream_object.update(trace)
if 'type' not in stream_object:
# tests if Scatter contains invalid kwargs
dummy_obj = copy.deepcopy(Scatter(**stream_object))
Copy link
Contributor Author

@Kully Kully May 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I am making a deepcopy of the trace being coerced into a Scatter from the original dict. The point is that an error will pop up if there is one, and stream_object can continue down the code being untouched and do its thing.

Do you think this is a good idea? Is it better to have the actual object the user sent raise the error?

@Kully
Copy link
Contributor Author

Kully commented May 7, 2018

@jmmease all the tests are passing in py3.6. Are you going to merge my PR to #942?

@jonmmease
Copy link
Contributor

Awesome!!! Sure I'll merge it on in

@jonmmease jonmmease merged commit f150a8c into ipyplotly_integration May 7, 2018
@jonmmease
Copy link
Contributor

@Kully Also, I'm not going to be active on this for a few weeks so why don't you go ahead and just work on the ipyplotly_integration branch directly from here on.

@Kully Kully deleted the test-fixes-2 branch May 7, 2018 15:26
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

Successfully merging this pull request may close these issues.

2 participants