Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/trunk/nappy/unit_tests/test_na_file_4010.py@3355
Revision 3355,
1.1 KB
checked in by astephen, 13 years ago
(diff) |
Improved tests code.
|
Line | |
---|
1 | """ |
---|
2 | test_na_file_4010.py |
---|
3 | ==================== |
---|
4 | |
---|
5 | Tests for the na_file_4010.py module. |
---|
6 | |
---|
7 | """ |
---|
8 | |
---|
9 | # Import standard library modules |
---|
10 | import unittest |
---|
11 | import os |
---|
12 | import sys |
---|
13 | |
---|
14 | # Import local modules |
---|
15 | base_dir = os.environ.get("NAPPY_BASE_DIR", "..\\..") |
---|
16 | sys.path.append(base_dir) |
---|
17 | |
---|
18 | import nappy |
---|
19 | import nappy.na_file.na_file |
---|
20 | |
---|
21 | class NAFile4010_TestCase(unittest.TestCase): |
---|
22 | |
---|
23 | def setUp(self): |
---|
24 | self.infile = os.path.join(base_dir, "data_files", "4010.na") |
---|
25 | self.outfile = os.path.join(base_dir, "test_outputs", "test_4010.na") |
---|
26 | self.fin = nappy.openNAFile(self.infile) |
---|
27 | self.fin.readData() |
---|
28 | self.na_dict = self.fin.getNADict() |
---|
29 | |
---|
30 | def test_read4010(self): |
---|
31 | "Tests reading FFI 4010." |
---|
32 | self.assertEqual(type(self.na_dict), type({1:2})) |
---|
33 | |
---|
34 | def test_write4010(self): |
---|
35 | "Tests writing FFI 4010." |
---|
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 | |
---|
39 | if __name__ == "__main__": |
---|
40 | |
---|
41 | unittest.main() |
---|
42 | |
---|
Note: See
TracBrowser
for help on using the repository browser.