Skip to content

Commit

Permalink
Making test script a bit more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrook committed Apr 24, 2013
1 parent 91685e7 commit 17dea1a
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,11 @@ def layerData( layer ):
fielddata[geomkey] = "None";

fielddata[fidkey] = f.id()
id = fielddata[fields[0]]
description = fielddata[fields[1]]
fielddata['id']=id
fielddata['description']=description
if 'id' not in fields: fields.insert(0,'id')
if 'description' not in fields: fields.insert(1,'description')
data[id]=fielddata
if 'id' not in fielddata: fielddata['id'] = str(f.id())
if 'description' not in fielddata: fielddata['description'] = fielddata[fields[1]]
data[fielddata['id']]=fielddata
if 'id' not in fields: fields.insert(0,'id')
if 'description' not in fields: fields.insert(1,'description')
fields.append(fidkey)
fields.append(geomkey)
return fields, data
Expand Down Expand Up @@ -656,8 +654,8 @@ def test_007_skip_lines(self):
createTest(description,filename,**params)
assert False,"Set printTests to False to run delimited text tests"
wanted={
u'3': {
'id': u'3',
'3': {
'id': '3',
'description': u'Less data',
'field_1': u'3',
'field_2': u'Less data',
Expand Down Expand Up @@ -1131,7 +1129,7 @@ def test_016_regular_expression_2(self):
'id': u'1',
'RE': u'RE',
'GEXP': u'GEXP',
'description': u'RE',
'description': u'Basic regular expression test',
'RE_1': u'RE',
'GEXP_1': u'GEXP',
'data': u'data1',
Expand All @@ -1145,7 +1143,7 @@ def test_016_regular_expression_2(self):
'id': u'2',
'RE': u'RE',
'GEXP': u'GEXP',
'description': u'RE',
'description': u'Basic regular expression test 2',
'RE_1': u'RE',
'GEXP_1': u'',
'data': u'data2',
Expand Down Expand Up @@ -1200,8 +1198,8 @@ def test_017a_regular_expression_4(self):
createTest(description,filename,**params)
assert False,"Set printTests to False to run delimited text tests"
wanted={
u'f': {
'id': u'f',
'2': {
'id': '2',
'description': u'i',
's': u'f',
'm': u'i',
Expand All @@ -1227,8 +1225,8 @@ def test_017a_regular_expression_5(self):
createTest(description,filename,**params)
assert False,"Set printTests to False to run delimited text tests"
wanted={
u'fi': {
'id': u'fi',
'2': {
'id': '2',
'description': u'..',
'small': u'fi',
'field_2': u'..',
Expand Down

0 comments on commit 17dea1a

Please sign in to comment.