Skip to content

Commit

Permalink
Fix sip bindings for QgsStringStatisticalSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 10, 2016
1 parent daabda8 commit 7ae80b1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion python/core/qgsstringstatisticalsummary.sip
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsstringstatisticalsummary.cpp
Expand Up @@ -54,7 +54,7 @@ void QgsStringStatisticalSummary::calculate( const QStringList& values )
}
}

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

Expand Down
4 changes: 3 additions & 1 deletion src/core/qgsstringstatisticalsummary.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsstringstatisticalsummary.py
Expand Up @@ -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)
Expand Down

0 comments on commit 7ae80b1

Please sign in to comment.