Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed Aug 6, 2017
1 parent 35918bb commit f830665
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ipywidgets/widgets/tests/test_set_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def serializer(instance, widget):
return { 'data': memoryview(instance.data) if instance.data else None }

def deserializer(json_data, widget):
return DataInstance( byte_type(json_data['data']) if json_data else None )
return DataInstance( json_data['data'].tobytes() if json_data else None )

class DataWidget(SimpleWidget):
d = Instance(DataInstance).tag(sync=True, to_json=serializer, from_json=deserializer)
Expand All @@ -54,7 +54,7 @@ class DataWidget(SimpleWidget):

# A widget that has a buffer that might be changed on reception:
def truncate_deserializer(json_data, widget):
return DataInstance( byte_type(json_data['data'][:20]) if json_data else None )
return DataInstance( json_data['data'][:20].tobytes() if json_data else None )

class TruncateDataWidget(SimpleWidget):
d = Instance(DataInstance).tag(sync=True, to_json=serializer, from_json=truncate_deserializer)
Expand Down
1 change: 1 addition & 0 deletions ipywidgets/widgets/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def teardown_test_comm():
delattr(Widget, attr)
else:
setattr(Widget, attr, value)
_widget_attrs.clear()

def setup():
setup_test_comm()
Expand Down

0 comments on commit f830665

Please sign in to comment.