Ignore:
Timestamp:
15/01/10 08:44:39 (11 years ago)
Author:
pnorton
Message:

Applied the fix to _mergeBounds so that it will cope with reversed bounds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qesdi/geoplot/trunk/lib/geoplot/tests/unit/test_grid_builder_base.py

    r5403 r6308  
    146146         
    147147    def test_011_mergeBounds(self): 
    148         unmergedBounds = N.array([[0.75, 1.25], [1.25, 1.75],  
    149                                   [1.75, 2.25], [2.25, 2.75]]) 
     148        unmergedBounds = N.array([[0.75, 1.25], [1.25, 1.75], [1.75, 2.25], [2.25, 2.75]]) 
    150149         
    151150        mergedBounds = GridBuilderBase._mergeBounds(unmergedBounds) 
    152151        nose.tools.assert_equal(mergedBounds.tolist(), [0.75, 1.25, 1.75, 2.25, 2.75])  
    153      
     152         
     153        # ascending, in order [low, high] 
     154        unmergedBounds = N.array([[1.0, 2.0], [2.0, 3.0], [3.0, 4.0]]) 
     155        mergedBounds = GridBuilderBase._mergeBounds(unmergedBounds) 
     156        nose.tools.assert_equal(mergedBounds.tolist(), [1.0, 2.0, 3.0, 4.0]) 
     157     
     158        # ascending in order [high, low] 
     159        unmergedBounds = N.array([[2.0, 1.0], [3.0, 2.0], [4.0, 3.0]]) 
     160        mergedBounds = GridBuilderBase._mergeBounds(unmergedBounds) 
     161        nose.tools.assert_equal(mergedBounds.tolist(), [1.0, 2.0, 3.0, 4.0]) 
     162         
     163        # decending in order [low, high] 
     164        unmergedBounds = N.array([[3.0, 4.0], [2.0, 3.0], [1.0, 2.0]]) 
     165        mergedBounds = GridBuilderBase._mergeBounds(unmergedBounds) 
     166        nose.tools.assert_equal(mergedBounds.tolist(), [4.0, 3.0, 2.0, 1.0]) 
     167         
     168        # decending in order [high, low] 
     169        unmergedBounds = N.array([[4.0, 3.0], [3.0, 2.0], [2.0, 1.0]]) 
     170        mergedBounds = GridBuilderBase._mergeBounds(unmergedBounds) 
     171        nose.tools.assert_equal(mergedBounds.tolist(), [4.0, 3.0, 2.0, 1.0]) 
     172             
    154173    def test_012_getBoundsFromAxis(self): 
    155174        axis =  cdms.createAxis(N.array([10.0,20.0,30.0,40.0,50.0])) 
Note: See TracChangeset for help on using the changeset viewer.