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

various display type validations #4565

Merged
merged 10 commits into from Jan 13, 2014
Merged

various display type validations #4565

merged 10 commits into from Jan 13, 2014

Conversation

minrk
Copy link
Member

@minrk minrk commented Nov 20, 2013

  • Formatters check their return type
  • some DisplayObjects check input args
  • javascript checks data types of display messages

Each of these individually would fix #4564

"""Validate that display data is text"""
def _check_data(self):
if self.data is not None and not isinstance(self.data, string_types):
raise TypeError("%s xpects text, not %r" % (self.__class__.__name__, self.data))
Copy link
Member

Choose a reason for hiding this comment

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

xpects.

@Carreau
Copy link
Member

Carreau commented Nov 22, 2013

The test faillure is in part due to an error on isolated SVG. might be related.
In any case, waiting for test case.

@Carreau
Copy link
Member

Carreau commented Nov 28, 2013

Still a typo, and relaunched the test to see if the failure is reproducible.

@Carreau
Copy link
Member

Carreau commented Dec 5, 2013

Same test failure in casper. @minrk @ivanov ?

@Carreau
Copy link
Member

Carreau commented Dec 11, 2013

What the status of this one ?

@minrk
Copy link
Member Author

minrk commented Dec 11, 2013

looking into the test failure now - in interactive use, the code in the test passes just fine, so something weird is going on.

@ivanov
Copy link
Member

ivanov commented Dec 11, 2013

it comes out null when there was no result. Over in #4533 I've updated the test so it'll return back the assertion error, instead of erroring out using

-        this.test.assertEquals(colors[0], '#ff0000', 'First svg should be red');
-        this.test.assertEquals(colors[1], '#000000', 'Second svg should be black');
+        this.test.assertEquals(colors && colors[0], '#ff0000', 'display_svg() First svg should be red');
+        this.test.assertEquals(colors && colors[1], '#000000', 'display_svg() Second svg should be black');

@minrk
Copy link
Member Author

minrk commented Dec 11, 2013

Nice - I think I'm on the trail of an actual undesired change in behavior. Just need to figure out the cause...

@minrk
Copy link
Member Author

minrk commented Dec 11, 2013

Should be passing now.

@Carreau
Copy link
Member

Carreau commented Dec 18, 2013

+1 I suppose at some point we could check_return using annotation on PY3, but that's for latter.

@@ -282,9 +303,22 @@ def __call__(self, obj):
return printer(obj)
return None
except Exception:
pass
self._handle_format_error(
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a duplicate of the warning display you added in #4745 - is it now unnecessary?

@ivanov
Copy link
Member

ivanov commented Jan 9, 2014

this no longer merges cleanly, either :\

@minrk
Copy link
Member Author

minrk commented Jan 9, 2014

I haven't touched this one in a while because I will need to rebase it after #4533 is merged

and show error messages when formatters fail
at DisplayObject construction time
everything is a string, if anything else is sent,
drop it so it doesn't show up in the notebook document.
validates from files, as well as from kernels
@minrk
Copy link
Member Author

minrk commented Jan 12, 2014

rebased

minrk added a commit that referenced this pull request Jan 13, 2014
various display type validations

to protect notebooks from invalid display data, and add informative errors for invalid data.
@minrk minrk merged commit a74c5bc into ipython:master Jan 13, 2014
@minrk minrk deleted the format_check branch January 13, 2014 21:03
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
various display type validations

to protect notebooks from invalid display data, and add informative errors for invalid data.
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.

Notebook save failure
4 participants