Permalink
Browse files

Add test to check that we recognize 'nan' as a numeric value (#4799)

git-svn-id: https://svn.osgeo.org/gdal/trunk@24901 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information...
1 parent e8ce38e commit 2d908755f5ff500117a0ac34aee2ad915f0d5d6b @rouault rouault committed Sep 3, 2012
Showing with 20 additions and 0 deletions.
  1. BIN autotest/ogr/data/nan.dbf
  2. +20 −0 autotest/ogr/ogr_shape.py
Binary file not shown.
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
@@ -3111,6 +3112,24 @@ def ogr_shape_64():
return 'success'
###############################################################################
+# Test reading a DBF with a 'nan' as a numeric value (#4799)
+
+def ogr_shape_65():
+
+ ds = ogr.Open('data/nan.dbf')
+ lyr = ds.GetLayer(0)
+ feat = lyr.GetNextFeature()
+ val = feat.GetFieldAsDouble(0)
+ feat = None
+ ds = None
+
+ if not gdaltest.isnan(val):
+ print(val)
+ return 'fail'
+
+ return 'success'
+
+###############################################################################
#
def ogr_shape_cleanup():
@@ -3206,6 +3225,7 @@ def ogr_shape_cleanup():
ogr_shape_62,
ogr_shape_63,
ogr_shape_64,
+ ogr_shape_65,
ogr_shape_cleanup ]
if __name__ == '__main__':

0 comments on commit 2d90875

Please sign in to comment.