Skip to content

Commit 48591df

Browse files
committed
Added testcase for longs
1 parent d996966 commit 48591df

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

tests/src/python/test_qgsdelimitedtextprovider.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# This will get replaced with a git SHA1 when you do a git archive
1313
__revision__ = '$Format:%H$'
1414

15-
# This module provides unit test for the delimtied text provider. It uses data files in
15+
# This module provides unit test for the delimited text provider. It uses data files in
1616
# the testdata/delimitedtext directory.
1717
#
1818
# New tests can be created (or existing ones updated), but incorporating a createTest
@@ -650,6 +650,12 @@ def test_037_csvt_file_invalid_file(self):
650650
requests=None
651651
runTest(filename,requests,**params)
652652

653+
def test_038_long_type(self):
654+
# Skip lines
655+
filename='testlongs.csv'
656+
params={'yField': 'lat', 'xField': 'lon', 'type': 'csv'}
657+
requests=None
658+
runTest(filename,requests,**params)
653659

654660
if __name__ == '__main__':
655661
unittest.main()

tests/src/python/test_qgsdelimitedtextprovider_wanted.py

+51
Original file line numberDiff line numberDiff line change
@@ -2165,3 +2165,54 @@ def test_037_csvt_file_invalid_file():
21652165
}
21662166
wanted['log']=[]
21672167
return wanted
2168+
2169+
def test_038_long_type():
2170+
wanted={}
2171+
filename="testlongs.csv"
2172+
wanted['uri']=u'file://{}?yField={}&xField={}&type={}'.format(filename,"lat","lon","csv")
2173+
wanted['fieldTypes']=['longlong', 'text', 'double', 'double', 'integer']
2174+
# long is casted as longlong because of QVariant limitation
2175+
wanted['data']={
2176+
2L: {
2177+
'id': u'9189304972279762602',
2178+
'a_long': u'9189304972279762602',
2179+
'lon': u'1.0',
2180+
'lat': u'1.0',
2181+
'an_integer': u'40',
2182+
'#geometry': 'POINT(1.0 1.0)',
2183+
'#fid':2L,
2184+
'description': 'line1'
2185+
},
2186+
3L: {
2187+
'id': u'9189304972279762602',
2188+
'a_long': u'9189304972279762602',
2189+
'lon': u'2.2',
2190+
'lat': u'2.5',
2191+
'an_integer': u'5',
2192+
'#geometry': 'POINT(2.2 2.5)',
2193+
'#fid':3L,
2194+
'description': 'line2'
2195+
},
2196+
4L: {
2197+
'id': u'-3123724580211819352',
2198+
'a_long': u'-3123724580211819352',
2199+
'lon': u'1.0',
2200+
'lat': u'1.0',
2201+
'an_integer': u'7',
2202+
'#geometry': 'POINT(1.0 1.0)',
2203+
'#fid':4L,
2204+
'description': 'line3'
2205+
},
2206+
5L: {
2207+
'id': u'-3',
2208+
'a_long': u'-3',
2209+
'lon': u'1.0',
2210+
'lat': u'1.0',
2211+
'an_integer': u'7',
2212+
'#geometry': 'POINT(1.0 1.0)',
2213+
'#fid':5L,
2214+
'description': 'line4'
2215+
}
2216+
}
2217+
wanted['log']=[]
2218+
return wanted
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
a_long,description,lon,lat,an_integer
2+
9189304972279762602,line1,1.0,1.0,40
3+
9189304972279762602,line2,2.2,2.5,5
4+
-3123724580211819352,line3,1.0,1.0,7
5+
-3,line4,1.0,1.0,7

0 commit comments

Comments
 (0)