Skip to content
Permalink
Browse files

Fix sip bindings for QgsStringStatisticalSummary

  • Loading branch information
nyalldawson committed May 10, 2016
1 parent daabda8 commit 7ae80b106d8f59db4d3a13c2b2632fe2ffb413e9
@@ -59,14 +59,16 @@ class QgsStringStatisticalSummary

/** Calculates summary statistics for a list of strings.
* @param values list of strings
* @see calculateFromVariants()
*/
void calculate( const QStringList& values );

/** Calculates summary statistics for a list of variants. Any non-string variants will be
* ignored.
* @param values list of variants
* @see calculate()
*/
void calculate( const QVariantList& values );
void calculateFromVariants( const QVariantList& values );

/** Returns the value of a specified statistic
* @param stat statistic to return
@@ -54,7 +54,7 @@ void QgsStringStatisticalSummary::calculate( const QStringList& values )
}
}

void QgsStringStatisticalSummary::calculate( const QVariantList& values )
void QgsStringStatisticalSummary::calculateFromVariants( const QVariantList& values )
{
reset();

@@ -79,14 +79,16 @@ class CORE_EXPORT QgsStringStatisticalSummary

/** Calculates summary statistics for a list of strings.
* @param values list of strings
* @see calculateFromVariants()
*/
void calculate( const QStringList& values );

/** Calculates summary statistics for a list of variants. Any non-string variants will be
* ignored.
* @param values list of variants
* @see calculate()
*/
void calculate( const QVariantList& values );
void calculateFromVariants( const QVariantList& values );

/** Returns the value of a specified statistic
* @param stat statistic to return
@@ -67,7 +67,7 @@ def testIndividualStats(self):
def testVariantStats(self):
s = QgsStringStatisticalSummary()
self.assertEqual(s.statistics(), QgsStringStatisticalSummary.All)
s.calculate(['cc', 5, 'bbbb', 'aaaa', 'eeee', 6, 9, '9', ''])
s.calculateFromVariants(['cc', 5, 'bbbb', 'aaaa', 'eeee', 6, 9, '9', ''])
self.assertEqual(s.count(), 6)
self.assertEqual(set(s.distinctValues()), set(['cc', 'aaaa', 'bbbb', 'eeee', '', '9']))
self.assertEqual(s.countMissing(), 1)

0 comments on commit 7ae80b1

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