Skip to content
Permalink
Browse files

Add python repr for QgsProviderMetadata

  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent d34d61e commit 4aa1c2f2991bf686bb0a17258ccc98b13198d6f0
@@ -446,6 +446,12 @@ Stores the connection in the settings
.. versionadded:: 3.10
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsProviderMetadata: %1>" ).arg( sipCpp->key() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

signals:

void connectionCreated( const QString &name );
@@ -483,6 +483,14 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
*/
virtual void saveConnection( const QgsAbstractProviderConnection *connection, const QString &name ) SIP_THROW( QgsProviderConnectionException );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsProviderMetadata: %1>" ).arg( sipCpp->key() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

signals:

/**
@@ -19,7 +19,7 @@
QgsMimeDataUtils, QgsVector, QgsVector3D, QgsVectorLayer, QgsReferencedPointXY, QgsReferencedRectangle,\
QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsProject, QgsClassificationRange, QgsBookmark, \
QgsLayoutMeasurement, QgsLayoutPoint, QgsLayoutSize, QgsUnitTypes, QgsConditionalStyle, QgsTableCell, QgsProperty, \
QgsVertexId, QgsReferencedGeometry
QgsVertexId, QgsReferencedGeometry, QgsProviderRegistry

start_app()

@@ -254,6 +254,9 @@ def testQgsVertexId(self):
v = QgsVertexId(1, 2, 3, _type=QgsVertexId.CurveVertex)
self.assertEqual(v.__repr__(), '<QgsVertexId: 1,2,3 CurveVertex>')

def testProviderMetadata(self):
self.assertEqual(QgsProviderRegistry.instance().providerMetadata('ogr').__repr__(), '<QgsProviderMetadata: ogr>')


if __name__ == "__main__":
unittest.main()

0 comments on commit 4aa1c2f

Please sign in to comment.
You can’t perform that action at this time.