def test_1(self): list1 = [1, 2, 3] list2 = [3, 4, 5, 6] expected = [1, 2, 3, 4, 5, 6] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected) r = union_sorted_lists(list2, list1) self.assertEqual(r, expected)
def _display_artwork_type(self): """Display image type in Type column. If both existing covers and new covers are to be displayed, take union of both cover types list. """ types = [image.types_as_string() for image in self.images] if self.display_existing_artwork: existing_types = [image.types_as_string() for image in self.existing_images] # Merge both types and existing types list in sorted order. types = union_sorted_lists(types, existing_types) for row, artwork_type in enumerate(types): self.artwork_table.insertRow(row) type_wgt = self.artwork_table.get_type_widget(artwork_type) item = QtWidgets.QTableWidgetItem() item.setData(QtCore.Qt.UserRole, artwork_type) self.artwork_table.setCellWidget(row, self.artwork_table._type_col, type_wgt) self.artwork_table.setItem(row, self.artwork_table._type_col, item)
def _display_artwork_type(self): """Display image type in Type column. If both existing covers and new covers are to be displayed, take union of both cover types list. """ types = [image.types_as_string() for image in self.obj.metadata.images] if self.display_existing_artwork: existing_types = [image.types_as_string() for image in self.obj.orig_metadata.images] #Merge both types and existing types list in sorted order. types = union_sorted_lists(types, existing_types) for row, type in enumerate(types): self.artwork_table.insertRow(row) type_wgt = self.artwork_table.get_type_widget(type) item = QtGui.QTableWidgetItem() item.setData(QtCore.Qt.UserRole, type) self.artwork_table.setCellWidget(row, self.artwork_table._type_col, type_wgt) self.artwork_table.setItem(row, self.artwork_table._type_col, item)
def _display_artwork_type(self): """Display image type in Type column. If both existing covers and new covers are to be displayed, take union of both cover types list. """ types = [image.types_as_string() for image in self.images] if self.display_existing_artwork: existing_types = [image.types_as_string() for image in self.existing_images] # Merge both types and existing types list in sorted order. types = union_sorted_lists(types, existing_types) pixmap_arrow = QtGui.QPixmap(":/images/arrow.png") else: pixmap_arrow = None for row, artwork_type in enumerate(types): self.artwork_table.insertRow(row) item = QtWidgets.QTableWidgetItem() item.setData(QtCore.Qt.UserRole, artwork_type) type_wgt = ArtworkCoverWidget(pixmap=pixmap_arrow, text=artwork_type) self.artwork_table.setCellWidget(row, self.artwork_table._type_col, type_wgt) self.artwork_table.setItem(row, self.artwork_table._type_col, item)
def test_4(self): list1 = ['Back', 'Back, Spine', 'Front', 'Front, Side'] list2 = ['Back', 'Back, Spine', 'Front', 'Front, Side'] expected = ['Back', 'Back, Spine', 'Front', 'Front, Side'] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected)
def test_2(self): list1 = [1, 3, 5, 7] list2 = [2, 4, 6, 8] expected = [1, 2, 3, 4, 5, 6, 7, 8] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected)
def test_1(self): list1 = [1, 2, 3] list2 = [3, 4, 5] expected = [1, 2, 3, 4, 5] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected)
def test_4(self): list1 = ['Back', 'Back, Spine', 'Front', 'Front, Side'] list2 = ['Back', 'Back, Spine', 'Front', 'Front, Side'] expected = ['Back', 'Back, Spine', 'Front', 'Front, Side'] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected)
def test_2(self): list1 = [1, 3, 5, 7] list2 = [2, 4, 6, 8] expected = [1, 2, 3, 4, 5, 6, 7, 8] r = union_sorted_lists(list1, list2) self.assertEqual(r, expected)