Skip to content

Commit 17dea1a

Browse files
committedApr 24, 2013
Making test script a bit more robust
1 parent 91685e7 commit 17dea1a

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed
 

‎tests/src/python/test_qgsdelimitedtextprovider.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,11 @@ def layerData( layer ):
101101
fielddata[geomkey] = "None";
102102

103103
fielddata[fidkey] = f.id()
104-
id = fielddata[fields[0]]
105-
description = fielddata[fields[1]]
106-
fielddata['id']=id
107-
fielddata['description']=description
108-
if 'id' not in fields: fields.insert(0,'id')
109-
if 'description' not in fields: fields.insert(1,'description')
110-
data[id]=fielddata
104+
if 'id' not in fielddata: fielddata['id'] = str(f.id())
105+
if 'description' not in fielddata: fielddata['description'] = fielddata[fields[1]]
106+
data[fielddata['id']]=fielddata
107+
if 'id' not in fields: fields.insert(0,'id')
108+
if 'description' not in fields: fields.insert(1,'description')
111109
fields.append(fidkey)
112110
fields.append(geomkey)
113111
return fields, data
@@ -656,8 +654,8 @@ def test_007_skip_lines(self):
656654
createTest(description,filename,**params)
657655
assert False,"Set printTests to False to run delimited text tests"
658656
wanted={
659-
u'3': {
660-
'id': u'3',
657+
'3': {
658+
'id': '3',
661659
'description': u'Less data',
662660
'field_1': u'3',
663661
'field_2': u'Less data',
@@ -1131,7 +1129,7 @@ def test_016_regular_expression_2(self):
11311129
'id': u'1',
11321130
'RE': u'RE',
11331131
'GEXP': u'GEXP',
1134-
'description': u'RE',
1132+
'description': u'Basic regular expression test',
11351133
'RE_1': u'RE',
11361134
'GEXP_1': u'GEXP',
11371135
'data': u'data1',
@@ -1145,7 +1143,7 @@ def test_016_regular_expression_2(self):
11451143
'id': u'2',
11461144
'RE': u'RE',
11471145
'GEXP': u'GEXP',
1148-
'description': u'RE',
1146+
'description': u'Basic regular expression test 2',
11491147
'RE_1': u'RE',
11501148
'GEXP_1': u'',
11511149
'data': u'data2',
@@ -1200,8 +1198,8 @@ def test_017a_regular_expression_4(self):
12001198
createTest(description,filename,**params)
12011199
assert False,"Set printTests to False to run delimited text tests"
12021200
wanted={
1203-
u'f': {
1204-
'id': u'f',
1201+
'2': {
1202+
'id': '2',
12051203
'description': u'i',
12061204
's': u'f',
12071205
'm': u'i',
@@ -1227,8 +1225,8 @@ def test_017a_regular_expression_5(self):
12271225
createTest(description,filename,**params)
12281226
assert False,"Set printTests to False to run delimited text tests"
12291227
wanted={
1230-
u'fi': {
1231-
'id': u'fi',
1228+
'2': {
1229+
'id': '2',
12321230
'description': u'..',
12331231
'small': u'fi',
12341232
'field_2': u'..',

0 commit comments

Comments
 (0)
Please sign in to comment.