Skip to content

Commit

Permalink
Fix tests on Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Feb 24, 2018
1 parent d335ac0 commit 70c83ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions glue/core/state_path_patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ glue_vispy_viewers.common.toolbar.PatchedElementSubsetState -> glue.core.subset.
glue.plugins.dendro_viewer.qt.viewer_widget.DendroWidget -> glue.plugins.dendro_viewer.qt.DendrogramViewer
glue.plugins.dendro_viewer.layer_artist.DendroLayerArtist -> glue.plugins.dendro_viewer.layer_artist.DendrogramLayerArtist
builtins.builtin_function_or_method -> types.BuiltinFunctionType
__builtin__.builtin_function_or_method -> types.BuiltinFunctionType
15 changes: 12 additions & 3 deletions glue/core/tests/test_data_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
from ..data_collection import DataCollection
from ..hub import HubListener
from ..message import (Message, DataCollectionAddMessage, DataRemoveComponentMessage,
DataCollectionDeleteMessage,
DataCollectionDeleteMessage, DataAddComponentMessage,
ComponentsChangedMessage, ExternallyDerivableComponentsChangedMessage)
from ..exceptions import IncompatibleAttribute

from .test_state import clone


class HubLog(HubListener):

def __init__(self):
Expand All @@ -30,6 +31,9 @@ def register_to_hub(self, hub):
def notify(self, message):
self.messages.append(message)

def clear(self):
self.messages[:] = []


class TestDataCollection(object):

Expand Down Expand Up @@ -159,10 +163,15 @@ def test_catch_data_add_component_message(self):
self.dc.append(d)
d.add_component(Component(np.array([1, 2, 3])), id1)
assert link not in self.dc._link_manager
self.log.clear()
d.add_component(dc, id2)

msg = self.log.messages[-1]
assert isinstance(msg, ComponentsChangedMessage)
msgs = sorted(self.log.messages)

assert isinstance(msgs[0], ComponentsChangedMessage)
assert isinstance(msgs[1], DataAddComponentMessage)
assert isinstance(msgs[2], ExternallyDerivableComponentsChangedMessage)

assert link in self.dc._link_manager

def test_links_auto_added(self):
Expand Down

0 comments on commit 70c83ef

Please sign in to comment.