source: nappy/trunk/nappy/unit_tests/test_na_file_2110.py @ 3355

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/trunk/nappy/unit_tests/test_na_file_2110.py@3355
Revision 3355, 1.1 KB checked in by astephen, 12 years ago (diff)

Improved tests code.

Line 
1"""
2test_na_file_2110.py
3====================
4
5Tests for the na_file_2110.py module.
6
7"""
8
9# Import standard library modules
10import unittest
11import os
12import sys
13
14# Import local modules
15base_dir = os.environ.get("NAPPY_BASE_DIR", "..\\..")
16sys.path.append(base_dir)
17
18import nappy
19import nappy.na_file.na_file
20
21class NAFile2110_TestCase(unittest.TestCase):
22
23    def setUp(self):
24        self.infile = os.path.join(base_dir, "data_files", "2110.na")
25        self.outfile = os.path.join(base_dir, "test_outputs", "test_2110.na")
26        self.fin = nappy.openNAFile(self.infile)
27        self.fin.readData()
28        self.na_dict = self.fin.getNADict()       
29
30    def test_read2110(self):
31        "Tests reading FFI 2110."
32        self.assertEqual(type(self.na_dict), type({1:2}))
33
34    def test_write2110(self):
35        "Tests writing FFI 2110."
36        self.fobj = nappy.openNAFile(self.outfile, mode="w", na_dict=self.na_dict)             
37        self.failUnless(isinstance(self.fobj, nappy.na_file.na_file.NAFile))
38
39if __name__ ==  "__main__":
40
41    unittest.main()
42
Note: See TracBrowser for help on using the repository browser.