Changeset 13381

Show
Ignore:
Timestamp:
12/18/07 22:50:51 (7 months ago)
Author:
mloskot
Message:

autotest\pymod\gdaltest.py: Added poor man tests NaN/Infinite? values in band statistics. This is related to testing problem reported in #1672 but affects all tests for rasters.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/autotest/pymod/gdaltest.py

    r12620 r13381  
    291291            new_stat = oBand.GetStatistics(1, 1) 
    292292            for i in range(4): 
     293 
     294                # NOTE - mloskot: Poor man Nan/Inf value check. It's poor 
     295                # because we need to support old and buggy Python 2.3. 
     296                # Tested on Linux, Mac OS X and Windows, with Python 2.3/2.4/2.5. 
     297                sv = str(new_stat[i]).lower() 
     298                if sv.find('n') >= 0 or sv.find('i') >= 0 or sv.find('#') >= 0: 
     299                    post_reason( 'NaN or Invinite value encountered '%'.' % sv ) 
     300                    return 'fail' 
     301 
    293302                if abs(new_stat[i]-check_approx_stat[i]) > stat_epsilon: 
    294303                    print 
     
    309318            new_stat = oBand.GetStatistics(0, 1) 
    310319            for i in range(4): 
     320 
     321                sv = str(new_stat[i]).lower() 
     322                if sv.find('n') >= 0 or sv.find('i') >= 0 or sv.find('#') >= 0: 
     323                    post_reason( 'NaN or Invinite value encountered '%'.' % sv ) 
     324                    return 'fail' 
     325 
    311326                if abs(new_stat[i]-check_stat[i]) > stat_epsilon: 
    312327                    print