Skip to content

Commit

Permalink
Add test for csvt fields types names non lowercase
Browse files Browse the repository at this point in the history
Ensure the fields types names are recognized when they are not lowercase too
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Nov 22, 2021
1 parent ee42e7c commit 05f5dac
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Expand Up @@ -933,6 +933,13 @@ def test_047_datetime(self):
assert vl.fields().at(6).type() == QVariant.Time
assert vl.fields().at(9).type() == QVariant.String

def test_048_csvt_file(self):
# CSVT field types non lowercase
filename = 'testcsvt5.csv'
params = {'geomType': 'none', 'type': 'csv'}
requests = None
self.runTest(filename, requests, **params)

def testSpatialIndex(self):
srcpath = os.path.join(TEST_DATA_DIR, 'provider')
basetestfile = os.path.join(srcpath, 'delimited_xyzm.csv')
Expand Down
29 changes: 29 additions & 0 deletions tests/src/python/test_qgsdelimitedtextprovider_wanted.py
Expand Up @@ -2587,3 +2587,32 @@ def test_042_no_detect_types_csvt():
wanted['log'] = [
]
return wanted


def test_048_csvt_file():
wanted = {}
wanted['uri'] = 'file://testcsvt5.csv?geomType=none&type=csv'
wanted['fieldTypes'] = ['text', 'text', 'double', 'double', 'double']
wanted['geometryType'] = 4
wanted['data'] = {
2: {
'id': '01',
'description': 'Test csvt 1',
'f1': '0.3',
'f2': '0.8',
'f3': '1.4',
'#fid': 2,
'#geometry': 'None',
},
3: {
'id': '12',
'description': 'Test csvt 2',
'f1': '0.2',
'f2': '78.0',
'f3': '13.4',
'#fid': 3,
'#geometry': 'None',
},
}
wanted['log'] = []
return wanted
3 changes: 3 additions & 0 deletions tests/testdata/delimitedtext/testcsvt5.csv
@@ -0,0 +1,3 @@
id,description,f1,f2,f3
01,Test csvt 1,0.3,0.8,1.4
12,Test csvt 2,0.2,78,13.4
1 change: 1 addition & 0 deletions tests/testdata/delimitedtext/testcsvt5.csvt
@@ -0,0 +1 @@
"String","String","Real","Real","Real"

0 comments on commit 05f5dac

Please sign in to comment.