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

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

Updated unit tests in light of re-factoring the write method.

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
19
20class NAFile2110_TestCase(unittest.TestCase):
21
22    def setUp(self):
23        self.infile = os.path.join(base_dir, "data_files", "2110.na")
24        self.outfile = os.path.join(base_dir, "test_outputs", "test_2110.na")
25        self.fin = nappy.openNAFile(self.infile)
26        self.fin.readData()
27        self.na_dict = self.fin.getNADict()       
28
29    def test_read2110(self):
30        "Tests reading FFI 2110."
31        self.assertEqual(type(self.na_dict), type({1:2}))
32
33    def test_write2110(self):
34        "Tests writing FFI 2110."
35        self.fobj = nappy.openNAFile(self.outfile, mode="w", na_dict=self.na_dict)             
36        self.fobj.write()
37        self.failUnless(isinstance(self.fobj, nappy.na_file.na_file.NAFile))
38
39if __name__ ==  "__main__":
40
41    unittest.main()
42
43
Note: See TracBrowser for help on using the repository browser.