def testQgsMapLayerRepr(self): vl = QgsVectorLayer( 'Point?crs=epsg:4326&field=pk:integer&field=cnt:integer&field=name:string(0)&field=name2:string(0)&field=num_char:string&key=pk', 'QGIS搖滾', 'memory') self.assertEqual(vl.__repr__(), "<QgsVectorLayer: 'QGIS搖滾' (memory)>") rl = QgsRasterLayer('', 'QGIS搖滾', 'gdal') self.assertEqual(rl.__repr__(), "<QgsRasterLayer: 'QGIS搖滾' (gdal)>") ml = QgsMeshLayer('', 'QGIS搖滾', 'mdal') self.assertEqual(ml.__repr__(), "<QgsMeshLayer: 'QGIS搖滾' (Invalid)>") al = QgsAnnotationLayer('QGIS搖滾', QgsAnnotationLayer.LayerOptions(QgsProject.instance().transformContext())) self.assertEqual(al.__repr__(), "<QgsAnnotationLayer: 'QGIS搖滾'>") pcl = QgsPointCloudLayer('', 'QGIS搖滾', 'pc') self.assertEqual(pcl.__repr__(), "<QgsPointCloudLayer: 'QGIS搖滾' (Invalid)>") vtl = QgsVectorTileLayer('', 'QGIS搖滾') self.assertEqual(vtl.__repr__(), "<QgsVectorTileLayer: 'QGIS搖滾'>")
def testQgsMapLayerRepr(self): vl = QgsVectorLayer( 'Point?crs=epsg:4326&field=pk:integer&field=cnt:integer&field=name:string(0)&field=name2:string(0)&field=num_char:string&key=pk', 'QGIS搖滾', 'memory') self.assertEqual(vl.__repr__(), "<QgsMapLayer: 'QGIS搖滾' (memory)>")