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

fix _compare_mimedata #492

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion nbdime/diffing/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from __future__ import unicode_literals

import json
import operator
import re
import copy
Expand Down Expand Up @@ -139,7 +140,14 @@ def _compare_mimedata(mimetype, x, y, comp_text, comp_base64):
# TODO: Compare binary images?
#if mimetype.startswith("image/"):
if isinstance(x, string_types) and isinstance(y, string_types):
_compare_mimedata_strings(x, y, comp_text, comp_base64)
return _compare_mimedata_strings(x, y, comp_text, comp_base64)

if mimetype == "application/json":
try:
return comp_text(json.dumps(x, indent=2), json.dumps(y, indent=2))
except TypeError:
pass

# Fallback to exactly equal
return x == y

Expand Down