Expand Up
@@ -362,6 +362,31 @@ def test_002a_field_naming(self):
runTest (description ,wanted ,log_wanted ,filename ,** params )
def test_002b_max_fields (self ):
description = 'Limiting maximum number of fields'
filename = 'testfields.csv'
params = {'geomType' : 'none' , 'maxFields' : '7' , 'type' : 'csv' }
if printTests :
createTest (description ,filename ,** params )
assert False ,"Set printTests to False to run delimited text tests"
wanted = {
u'1' : {
'id' : u'1' ,
'description' : u'Generation of field names' ,
'data' : u'Some data' ,
'field_4' : u'Some info' ,
'data_1' : u'' ,
'field_6' : u'' ,
'field_7' : u'' ,
'#fid' : 2L ,
'#geometry' : 'None' ,
},
}
log_wanted = [
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
def test_003_load_whitespace (self ):
description = 'Whitespace file parsing'
filename = 'test.space'
Expand Down
Expand Up
@@ -589,7 +614,7 @@ def test_005_multiple_quote(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid record format at line 7' ,
u'Invalid record format at line 8' ,
u'Invalid record format at line 9' ,
Expand All
@@ -616,7 +641,7 @@ def test_005a_badly_formed_quotes(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid record format at line 2' ,
u'Invalid record format at line 5' ,
]
Expand Down
Expand Up
@@ -681,7 +706,7 @@ def test_008_read_coordinates(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid X or Y fields at line 4' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
Expand Down
Expand Up
@@ -728,7 +753,7 @@ def test_009_read_wkt(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid WKT at line 8' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
Expand Down
Expand Up
@@ -775,7 +800,7 @@ def test_010_read_wkt_point(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid WKT at line 8' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
Expand Down
Expand Up
@@ -822,7 +847,7 @@ def test_011_read_wkt_line(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid WKT at line 8' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
Expand Down
Expand Up
@@ -851,7 +876,7 @@ def test_012_read_wkt_polygon(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid WKT at line 8' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
Expand Down
Expand Up
@@ -1020,7 +1045,7 @@ def test_013_read_dms_xy(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid X or Y fields at line 27' ,
u'Invalid X or Y fields at line 28' ,
u'Invalid X or Y fields at line 29' ,
Expand Down
Expand Up
@@ -1161,12 +1186,62 @@ def test_017_regular_expression_3(self):
}
log_wanted = [
u'Errors in file file' ,
u'The following lines were not loaded from file into QGIS due to errors:\n ' ,
u'The following lines were not loaded into QGIS due to errors:' ,
u'Invalid record format at line 3' ,
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
def test_017a_regular_expression_4 (self ):
description = 'Parsing zero length re'
filename = 'testre3.txt'
params = {'geomType' : 'none' , 'delimiter' : 'x?' , 'type' : 'regexp' }
if printTests :
createTest (description ,filename ,** params )
assert False ,"Set printTests to False to run delimited text tests"
wanted = {
u'f' : {
'id' : u'f' ,
'description' : u'i' ,
's' : u'f' ,
'm' : u'i' ,
'a' : u'.' ,
'l' : u'.' ,
'l_1' : u'i' ,
'field_6' : u'l' ,
'field_7' : u'e' ,
'#fid' : 2L ,
'#geometry' : 'None' ,
},
}
log_wanted = [
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
def test_017a_regular_expression_5 (self ):
description = 'Parsing zero length re 2'
filename = 'testre3.txt'
params = {'geomType' : 'none' , 'delimiter' : '\\ b' , 'type' : 'regexp' }
if printTests :
createTest (description ,filename ,** params )
assert False ,"Set printTests to False to run delimited text tests"
wanted = {
u'fi' : {
'id' : u'fi' ,
'description' : u'..' ,
'small' : u'fi' ,
'field_2' : u'..' ,
'field_3' : u'ile' ,
'#fid' : 2L ,
'#geometry' : 'None' ,
},
}
log_wanted = [
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
def test_018_utf8_encoded_file (self ):
description = 'UTF8 encoded file test'
filename = 'testutf8.csv'
Expand Down
Expand Up
@@ -1208,8 +1283,6 @@ def test_019_latin1_encoded_file(self):
]
runTest (description ,wanted ,log_wanted ,filename ,** params )
#END
if __name__ == '__main__' :
Expand Down