source: qesdi/geoplot/trunk/lib/geoplot/tests/unit/test_grid.py @ 5403

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/geoplot/trunk/lib/geoplot/tests/unit/test_grid.py@5403
Revision 5403, 1.3 KB checked in by pnorton, 11 years ago (diff)

Moved QESDI tree from DCIP repository
 http://proj.badc.rl.ac.uk/svn/dcip/qesdi@3900.

Line 
1#/urs/bin/env python
2"""
3test_grid_builder_base.py
4"""
5import nose
6import numpy as N
7
8import geoplot.grid
9from geoplot.grid import Grid
10
11class Test_Grid(object):
12
13    def setUp(self):
14        self.boundX = N.array([1.0, 3.0, 5.0, 7.0 ,9.0])
15        self.boundY = N.array([11.0, 13.0, 15.0, 17.0 ,19.0])
16        self.midX = N.array([2.0, 4.0, 6.0, 8.0])
17        self.midY = N.array([12.2, 14.4, 16.6, 18.8])
18        self.vals = N.array([[1.5, 2.0, 2.5, 3.0], [3.5, 4.0, 4.5, 5.0], 
19                             [5.5, 6.0, 6.5, 7.0], [7.5, 8.0, 8.5, 9.0]])
20        self.grd = Grid(self.boundX, self.boundY, self.midX, self.midY, self.vals)
21       
22   
23    def tearDown(self):
24        self.grd = None
25   
26    def test_001_checkAttribuesAreSetCorrectly(self):
27        nose.tools.assert_equal(self.boundX.tolist(), self.grd.boundsX.tolist())
28        nose.tools.assert_equal(self.boundY.tolist(), self.grd.boundsY.tolist())
29        nose.tools.assert_equal(self.midX.tolist(), self.grd.midpointsX.tolist())
30        nose.tools.assert_equal(self.midY.tolist(), self.grd.midpointsY.tolist())
31        nose.tools.assert_equal(self.vals.tolist(), self.grd.values.tolist())
32   
33if __name__ == '__main__':
34
35    import geoplot.log_util
36    geoplot.log_util.setGeoplotHandlerToStdOut()
37
38    nose.runmodule()
Note: See TracBrowser for help on using the repository browser.