Skip to content
Snippets Groups Projects
Commit 7c82d52a authored by Anne Philipp's avatar Anne Philipp
Browse files

removed old doc dir and pythontest dir

parent 067a0c3e
No related branches found
No related tags found
No related merge requests found
,philipa8,localhost,21.08.2018 16:15,file:///home/philipa8/.config/libreoffice/4;
\ No newline at end of file
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import os
sys.path.append('../python')
from tools import init128, to_param_id, my_error, read_ecenv
class TestTools(unittest.TestCase):
'''
'''
def setUp(self):
pass
def test_init128(self):
'''
'''
table128 = init128('../grib_templates/ecmwf_grib1_table_128')
expected = {'078': 'TCLW', '130': 'T', '034': 'SST'}
# check a sample of parameters which must have been read in
result = all((k in table128 and table128[k]==v) for k,v in expected.iteritems())
self.assertEqual(result, True)
def test_to_param_id(self):
'''
'''
table128 = init128('../grib_templates/ecmwf_grib1_table_128')
pars = to_param_id("T/SP/LSP/SSHF", table128)
for par in pars:
self.assertIn(par, [130, 134, 142, 146])
def test_error_notifcation(self):
'''
'''
with self.assertRaises(SystemExit) as re:
my_error(['${USER}', 'anne.philipp@univie.ac.at'], 'Failed!')
self.assertEqual(re.exception.code, 1)
def test_read_ecenv(self):
envs_ref = {'ECUID': 'km4a',
'ECGID': 'at',
'GATEWAY': 'srvx8.img.univie.ac.at',
'DESTINATION': 'annep@genericSftp'
}
envs = read_ecenv(os.getcwd() + '/TestData/ECMWF_ENV')
self.assertDictEqual(envs_ref, envs)
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
import sys
sys.path.append('../python')
import UioFiles
class TestUioFiles(unittest.TestCase):
'''
Test class to test the UIOFiles methods.
'''
def setUp(self):
'''
@Description:
Prepare test case. Initialize comparing filelist and
the test path.
@Input:
self: instance of TestUIOFiles
Class to test the UIOFiles methods.
@Return:
<nothing>
'''
self.testpath = os.path.join(os.path.dirname(__file__), 'TestDir')
self.expected = ['FCGG__SL.20160410.40429.16424.grb',
'FCOG__ML.20160410.40429.16424.grb',
'FCSH__ML.20160410.40429.16424.grb',
'OG_OROLSM__SL.20160410.40429.16424.grb',
'FCOG_acc_SL.20160409.40429.16424.grb',
'FCOG__SL.20160410.40429.16424.grb',
'FCSH__SL.20160410.40429.16424.grb']
return
def test_listFiles(self):
'''
@Description:
Test the listFiles method from class UIOFiles.
@Input:
self: instance of TestClass
Class to test the UIOFiles methods.
@Return:
<nothing>
'''
# Initialise and collect filenames
files = UioFiles.UioFiles(['.grb'])
files.list_files(self.testpath, '*')
# get the basename to just check for equality of filenames
filelist = [os.path.basename(f) for f in files.files]
# comparison of expected filenames against the collected ones
self.assertItemsEqual(self.expected, filelist)
return
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: Anne Philipp (University of Vienna)
@Date: March 2018
@License:
(C) Copyright 2014 UIO.
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
"""
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment