source: nappy/trunk/nappy/unit_tests/test_na_file_1001.py @ 3339

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/trunk/nappy/unit_tests/test_na_file_1001.py@3339
Revision 3339, 1.1 KB checked in by astephen, 12 years ago (diff)
Line 
1"""
2test_na_file_1001.py
3====================
4
5Tests for the na_file_1001.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 NAFile1001_TestCase(unittest.TestCase):
23
24    def setUp(self):
25        self.infile = os.path.join(base_dir, "data_files", "1001.na")
26        self.outfile = os.path.join(base_dir, "test_outputs", "test_1001.na")
27        self.fin = nappy.openNAFile(self.infile)
28        self.fin.readData()
29        self.na_dict = self.fin.getNADict()       
30
31    def test_read1001(self):
32        "Tests reading FFI 1001."
33        self.assertEqual(type(self.na_dict), type({1:2}))
34
35    def test_write1001(self):
36        "Tests writing FFI 1001."
37        self.fobj = nappy.openNAFile(self.outfile, mode="w", naDict=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.