Skip to content

Commit c7aa0dd

Browse files
committed
Bump length of image widget repr, and fix test
1 parent 578e074 commit c7aa0dd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ipywidgets/widgets/tests/test_widget_image.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ def test_value_repr_length():
149149
with get_logo_png() as LOGO_PNG:
150150
with open(LOGO_PNG, 'rb') as f:
151151
img = Image.from_file(f)
152-
assert len(img.__repr__()) < 120
153-
assert img.__repr__().endswith("...')")
152+
assert len(img.__repr__()) < 140
153+
assert img.__repr__().endswith(")")
154+
assert img.__repr__()[-5:-2] == '...'
154155

155156

156157
def test_value_repr_url():

ipywidgets/widgets/widget_media.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def _get_repr(self, cls):
117117
# Return value first like a ValueWidget
118118
signature = []
119119

120-
sig_value = 'value={!r}'.format(self.value[:30].tobytes())
121-
if self.value.nbytes > 30:
120+
sig_value = 'value={!r}'.format(self.value[:40].tobytes())
121+
if self.value.nbytes > 40:
122122
sig_value = sig_value[:-1]+"..."+sig_value[-1]
123123
signature.append(sig_value)
124124

0 commit comments

Comments
 (0)