source: flex_extract.git/pythontest/TestUIOFiles.py @ 54a8a01

dev
Last change on this file since 54a8a01 was 54a8a01, checked in by Anne Philipp <anne.philipp@…>, 17 months ago

restructuring, documentations and bug fixes

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4import unittest
5import os
6import sys
7sys.path.append('../python')
8import UioFiles
9
10
11class TestUioFiles(unittest.TestCase):
12    '''
13    Test class to test the UIOFiles methods.
14    '''
15
16    def setUp(self):
17        '''
18        @Description:
19            Prepare test case. Initialize comparing filelist and
20            the test path.
21
22        @Input:
23            self: instance of TestUIOFiles
24                Class to test the UIOFiles methods.
25
26        @Return:
27            <nothing>
28        '''
29        self.testpath = os.path.join(os.path.dirname(__file__), 'TestDir')
30        self.expected = ['FCGG__SL.20160410.40429.16424.grb',
31                         'FCOG__ML.20160410.40429.16424.grb',
32                         'FCSH__ML.20160410.40429.16424.grb',
33                         'OG_OROLSM__SL.20160410.40429.16424.grb',
34                         'FCOG_acc_SL.20160409.40429.16424.grb',
35                         'FCOG__SL.20160410.40429.16424.grb',
36                         'FCSH__SL.20160410.40429.16424.grb']
37
38        return
39
40    def test_listFiles(self):
41        '''
42        @Description:
43            Test the listFiles method from class UIOFiles.
44
45        @Input:
46            self: instance of TestClass
47                Class to test the UIOFiles methods.
48
49        @Return:
50            <nothing>
51        '''
52
53        # Initialise and collect filenames
54        files = UioFiles.UioFiles(['.grb'])
55        files.list_files(self.testpath, '*')
56        # get the basename to just check for equality of filenames
57        filelist = [os.path.basename(f) for f in files.files]
58        # comparison of expected filenames against the collected ones
59        self.assertItemsEqual(self.expected, filelist)
60
61        return
62
63if __name__ == "__main__":
64    unittest.main()
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG