diff --git a/glue/app/qt/tests/test_application.py b/glue/app/qt/tests/test_application.py index c9e798874..3172ae452 100644 --- a/glue/app/qt/tests/test_application.py +++ b/glue/app/qt/tests/test_application.py @@ -311,7 +311,7 @@ def check_clone_app(app): for tab1, tab2 in zip(app.viewers, copy.viewers): assert len(tab1) == len(tab2) for v1, v2 in zip(tab1, tab2): - assert type(v1) == type(v2) + assert type(v1) is type(v2) # same window properties assert v1.viewer_size == v2.viewer_size assert v1.position == v2.position diff --git a/glue/core/data_derived.py b/glue/core/data_derived.py index f29959727..af14a1f29 100644 --- a/glue/core/data_derived.py +++ b/glue/core/data_derived.py @@ -73,7 +73,7 @@ def indices(self, value): changed = False for idim in range(self._original_data.ndim): before, after = self._indices[idim], value[idim] - if type(before) != type(after): + if type(before) is not type(after): raise TypeError("Can't change where the ``None`` values are in indices") elif before != after: changed = True diff --git a/glue/core/data_factories/helpers.py b/glue/core/data_factories/helpers.py index b34b15a7a..dad34e889 100644 --- a/glue/core/data_factories/helpers.py +++ b/glue/core/data_factories/helpers.py @@ -147,7 +147,7 @@ def reload(self): mapping = dict((c, log.component(self.id(c)).data) for c in dold._components.values() if c in self.components and - type(c) == Component) + type(c) is Component) dold.coords = dnew.coords dold.update_components(mapping) diff --git a/glue/core/layer_artist.py b/glue/core/layer_artist.py index d98889291..b7b5b8756 100644 --- a/glue/core/layer_artist.py +++ b/glue/core/layer_artist.py @@ -265,7 +265,7 @@ def on_changed(self, func): def _duplicate(self, artist): for a in self.artists: - if type(a) == type(artist) and a.layer is artist.layer: + if type(a) is type(artist) and a.layer is artist.layer: return True return False diff --git a/glue/core/qt/data_collection_model.py b/glue/core/qt/data_collection_model.py index 43e4a8045..405e9cb25 100644 --- a/glue/core/qt/data_collection_model.py +++ b/glue/core/qt/data_collection_model.py @@ -179,7 +179,7 @@ def label(self, value): @property def tooltip(self): - if type(self.subset_group.subset_state) == core.subset.SubsetState: + if type(self.subset_group.subset_state) is core.subset.SubsetState: return "Empty subset" atts = self.subset_group.subset_state.attributes diff --git a/glue/core/tests/test_coordinates.py b/glue/core/tests/test_coordinates.py index 5f650cb73..8843d063d 100644 --- a/glue/core/tests/test_coordinates.py +++ b/glue/core/tests/test_coordinates.py @@ -170,31 +170,31 @@ class TestCoordinatesFromHeader(object): def test_2d_nowcs(self): hdr = {"NAXIS": 2} coord = coordinates_from_header(hdr) - assert type(coord) == IdentityCoordinates + assert type(coord) is IdentityCoordinates assert coord.pixel_n_dim == 2 assert coord.world_n_dim == 2 def test_2d(self): hdr = header_from_string(HDR_2D_VALID) coord = coordinates_from_header(hdr) - assert type(coord) == WCSCoordinates + assert type(coord) is WCSCoordinates def test_3d_nowcs(self): hdr = HDR_3D_VALID_NOWCS coord = coordinates_from_header(header_from_string(hdr)) - assert type(coord) == IdentityCoordinates + assert type(coord) is IdentityCoordinates assert coord.pixel_n_dim == 3 assert coord.world_n_dim == 3 def test_3d(self): hdr = header_from_string(HDR_3D_VALID_WCS) coord = coordinates_from_header(hdr) - assert type(coord) == WCSCoordinates + assert type(coord) is WCSCoordinates def test_nod(self): hdr = 0 coord = coordinates_from_header(hdr) - assert type(coord) == IdentityCoordinates + assert type(coord) is IdentityCoordinates HDR_2D_VALID = """ diff --git a/glue/core/tests/test_link_manager.py b/glue/core/tests/test_link_manager.py index efab59023..e187e7241 100644 --- a/glue/core/tests/test_link_manager.py +++ b/glue/core/tests/test_link_manager.py @@ -36,10 +36,10 @@ def example_components(self, add_derived=True): dummy_using = lambda x, y: (x, y) self.cs = [c1, c2, c3, c4, c5, c6, c7, c8] - self.links = [ComponentLink([c1], c3, lambda x:x), - ComponentLink([c2], c4, lambda x:x), - ComponentLink([c3], c1, lambda x:x), - ComponentLink([c4], c2, lambda x:x), + self.links = [ComponentLink([c1], c3, lambda x: x), + ComponentLink([c2], c4, lambda x: x), + ComponentLink([c3], c1, lambda x: x), + ComponentLink([c4], c2, lambda x: x), ComponentLink([c3, c4], c5, dummy_using), ComponentLink([c3, c4], c6, dummy_using)] diff --git a/glue/core/tests/test_subset.py b/glue/core/tests/test_subset.py index 45356072a..4f6bd81a7 100644 --- a/glue/core/tests/test_subset.py +++ b/glue/core/tests/test_subset.py @@ -440,7 +440,7 @@ def assert_composite_copy(self, cls): s1 = cls(state1, state2) s2 = s1.copy() - assert type(s1) == type(s2) + assert type(s1) is type(s2) assert s1.state1.copy() is s2.state1 assert s1.state2.copy() is s2.state2 diff --git a/glue/viewers/image/qt/slice_widget.py b/glue/viewers/image/qt/slice_widget.py index 3fc80910b..21a3446af 100644 --- a/glue/viewers/image/qt/slice_widget.py +++ b/glue/viewers/image/qt/slice_widget.py @@ -88,7 +88,7 @@ def sync_sliders_from_state(self, *args): # but we will need to generalize this in future. We deliberately # check the type of data.coords here since we want to treat # subclasses differently. - if getattr(self.data, 'coords') is not None and type(self.data.coords) != LegacyCoordinates: + if getattr(self.data, 'coords') is not None and type(self.data.coords) is not LegacyCoordinates: world_axis_index = self.data.ndim - 1 - i world = world_axis(self.data.coords, self.data, pixel_axis=world_axis_index, diff --git a/glue/viewers/image/viewer.py b/glue/viewers/image/viewer.py index 97288583e..02f23e243 100644 --- a/glue/viewers/image/viewer.py +++ b/glue/viewers/image/viewer.py @@ -127,7 +127,7 @@ def _set_wcs(self, before=None, after=None, relim=True): self.state.reset_limits() # Determine whether changing slices requires changing the WCS - if ref_coords is None or type(ref_coords) == Coordinates: + if ref_coords is None or type(ref_coords) is Coordinates: self._changing_slice_requires_wcs_update = False else: ix = self.state.x_att.axis