def test_remove_subset(self):
     subset = SubPDSSpectImageSet(self.test_set)
     subset2 = SubPDSSpectImageSet(self.test_set)
     self.test_set.add_subset(subset)
     assert len(self.test_set.subsets) == 1
     self.test_set.remove_subset(subset2)
     assert len(self.test_set.subsets) == 1
     assert subset in self.test_set.subsets
     self.test_set.remove_subset('foo')
     assert len(self.test_set.subsets) == 1
     assert subset in self.test_set.subsets
     self.test_set.remove_subset(subset)
     assert len(self.test_set.subsets) == 0
     assert subset not in self.test_set.subsets
 def test_add_subset(self):
     subset = SubPDSSpectImageSet(self.test_set)
     assert len(self.test_set.subsets) == 0
     self.test_set.add_subset(subset)
     assert len(self.test_set.subsets) == 1
     assert subset in self.test_set.subsets
     self.test_set.add_subset('foo')
     assert len(self.test_set.subsets) == 1
     assert 'foo' not in self.test_set.subsets
Example #3
0
 def test_change_image2(self, basic):
     subset = SubPDSSpectImageSet(self.image_set)
     basic.change_image(1)
     self.basic_widget.add_basic(subset, self.view_canvas)
     basic2 = self.basic_widget.basics[1]
     assert basic.histogram.connected_models == []
     assert basic2.histogram.connected_models == []
     basic.change_image(0)
     assert basic.histogram.connected_models == [basic2.histogram]
     assert basic2.histogram.connected_models == [basic.histogram]
Example #4
0
 def test_connect_model(self, basic_widget):
     image_set = self.image_set
     basic = basic_widget.basics[0]
     subset1 = SubPDSSpectImageSet(self.image_set)
     basic1 = Basic(subset1, self.image_view, basic_widget)
     basic_widget.basics.append(basic1)
     assert image_set.current_image_index == subset1.current_image_index
     basic_widget.connect_model(basic1)
     assert basic1.histogram.connected_models == [basic.histogram]
     assert basic.histogram.connected_models == [basic1.histogram]
     subset2 = SubPDSSpectImageSet(self.image_set)
     basic2 = Basic(subset2, self.image_view, basic_widget)
     basic_widget.basics.append(basic2)
     subset2.current_image_index = 1
     assert image_set.current_image_index != subset2.current_image_index
     assert subset1.current_image_index != subset2.current_image_index
     basic_widget.connect_model(basic2)
     assert basic1.histogram.connected_models == [basic.histogram]
     assert basic.histogram.connected_models == [basic1.histogram]
     assert basic2.histogram.connected_models == []
     subset1.current_image_index = 2
     assert image_set.current_image_index != subset1.current_image_index
     assert image_set.current_image_index != subset2.current_image_index
     assert subset1.current_image_index != subset2.current_image_index
     basic_widget.connect_model(basic1)
     assert basic1.histogram.connected_models == []
     assert basic.histogram.connected_models == []
     assert basic2.histogram.connected_models == []
class TestSubPDSSpectImageSet(object):
    image_set = PDSSpectImageSet(TEST_FILES)
    subset = SubPDSSpectImageSet(image_set)

    def test_init(self):
        subset = self.subset
        assert subset.parent_set == self.image_set
        assert not subset._views
        assert subset.current_image_index == self.image_set.current_image_index
        assert subset.current_color_index == self.image_set.current_color_index
        assert subset.zoom == self.image_set.zoom
        assert subset.center == self.image_set.center
        assert subset.alpha == self.image_set.alpha
        assert not subset._roi_data.any()
        assert subset.selection_index == self.image_set.selection_index
        assert subset.flip_x == self.image_set.flip_x
        assert subset.flip_y == self.image_set.flip_y
        assert subset.swap_xy == self.image_set.swap_xy
        assert subset.shape == self.image_set.shape
        assert subset.images == self.image_set.images
        assert not subset._simultaneous_roi
Example #6
0
 def test_add_pan(self, pan_widget):
     subset = SubPDSSpectImageSet(self.image_set)
     pan2 = PanView(subset)
     pan_widget.add_pan(pan2)
     assert pan_widget.pans[1] == pan2
     assert pan_widget.main_layout.itemAt(1).widget() == pan2
Example #7
0
 def test_create_spect_view(self, view_widget):
     subset = SubPDSSpectImageSet(self.image_set)
     spect_view = view_widget.create_spect_view(subset)
     spect_view == view_widget.spect_views[1]
     assert view_widget.main_layout.itemAt(1).widget() == spect_view