source: nappy/trunk/nappy/unit_tests/test_na_file_1010.py @ 3353

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/trunk/nappy/unit_tests/test_na_file_1010.py@3353
Revision 3353, 1.1 KB checked in by astephen, 12 years ago (diff)
Line 
1"""
2test_na_file_1010.py
3====================
4
5Tests for the na_file_1010.py module.
6
7"""
8
9# Import standard library modules
10import unittest
11import os
12import sys
13
14# Import local modules
15os.environ["NAPPY_BASE_DIR"] = "..\\.."
16base_dir = os.environ["NAPPY_BASE_DIR"]
17sys.path.append(base_dir)
18
19import nappy
20import nappy.na_file.na_file
21
22class NAFile1010_TestCase(unittest.TestCase):
23
24    def setUp(self):
25        self.infile = os.path.join(base_dir, "data_files", "1010.na")
26        self.outfile = os.path.join(base_dir, "test_outputs", "test_1010.na")
27        self.fin = nappy.openNAFile(self.infile)
28        self.fin.readData()
29        self.na_dict = self.fin.getNADict()       
30
31    def test_read1010(self):
32        "Tests reading FFI 1010."
33        self.assertEqual(type(self.na_dict), type({1:2}))
34
35    def test_write1010(self):
36        "Tests writing FFI 1010."
37        self.fobj = nappy.openNAFile(self.outfile, mode="w", na_dict=self.na_dict)             
38        self.failUnless(isinstance(self.fobj, nappy.na_file.na_file.NAFile))
39
40if __name__ ==  "__main__":
41
42    unittest.main()
43
Note: See TracBrowser for help on using the repository browser.