Skip to content
Permalink
Browse files

Add a provider test for a crash experienced in SQL Server provider

  • Loading branch information
nyalldawson committed Oct 5, 2018
1 parent b7f5a3c commit a6ae6c1702462a9499e2c52a0415174f5827128b
Showing with 11 additions and 0 deletions.
  1. +11 −0 tests/src/python/providertestbase.py
@@ -309,6 +309,9 @@ def testGetFeaturesPolyFilterRectTests(self):
assert set(features) == set([1, 2, 3, 4, 5]), 'Got {} instead'.format(features)

def testMinValue(self):
self.assertIsNone(self.source.minimumValue(-1))
self.assertIsNone(self.source.minimumValue(1000))

self.assertEqual(self.source.minimumValue(self.source.fields().lookupField('cnt')), -200)
self.assertEqual(self.source.minimumValue(self.source.fields().lookupField('name')), 'Apple')

@@ -320,6 +323,8 @@ def testMinValue(self):
self.assertEqual(min_value, 200)

def testMaxValue(self):
self.assertIsNone(self.source.maximumValue(-1))
self.assertIsNone(self.source.maximumValue(1000))
self.assertEqual(self.source.maximumValue(self.source.fields().lookupField('cnt')), 400)
self.assertEqual(self.source.maximumValue(self.source.fields().lookupField('name')), 'Pear')

@@ -362,6 +367,9 @@ def testExtent(self):
self.assertTrue(provider_extent.isNull())

def testUnique(self):
self.assertEqual(self.source.uniqueValues(-1), set())
self.assertEqual(self.source.uniqueValues(1000), set())

self.assertEqual(set(self.source.uniqueValues(self.source.fields().lookupField('cnt'))),
set([-200, 100, 200, 300, 400]))
assert set(['Apple', 'Honey', 'Orange', 'Pear', NULL]) == set(
@@ -376,6 +384,9 @@ def testUnique(self):
self.assertEqual(set(values), set([200, 300]))

def testUniqueStringsMatching(self):
self.assertEqual(self.source.uniqueStringsMatching(-1, 'a'), [])
self.assertEqual(self.source.uniqueStringsMatching(100001, 'a'), [])

field_index = self.source.fields().lookupField('name')
self.assertEqual(set(self.source.uniqueStringsMatching(field_index, 'a')), set(['Pear', 'Orange', 'Apple']))
# test case insensitive

0 comments on commit a6ae6c1

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