3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-04 18:36:05 +02:00

Fixed 'inpconf' tests after the recent changes

Some of the options of the config-file has been modified.
The tests have been adapted accordingly.
This commit is contained in:
Oleg E. Peil 2015-11-13 13:54:26 +01:00
parent a61e0b2526
commit 8a718ea906
9 changed files with 26 additions and 31 deletions

View File

@ -1,16 +1,15 @@
[General]
BASENAME = test_base
EFERMI = 0.1
DOSMESH = -8.0 4.0 101
[Group 1]
SHELLS = 1 2
EMIN = -7.6
EMAX = 3.0
EWINDOW = -7.6 3.0
[Group 2]
SHELLS = 3
EMIN = -1.6
EMAX = 2.0
EWINDOW = -1.6 2.0
[Shell 1]
LSHELL = 2
@ -20,9 +19,9 @@ IONS = 5..8
LSHELL = 1
IONS = 1..4
RTRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
TRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
[Shell 3]
LSHELL = 3

View File

@ -1,7 +1,6 @@
[Shell 1]
LSHELL = 2
IONS = 5..8
EMIN = -7.6
EMAX = 3.0
EWINDOW = -7.6 3.0

View File

@ -2,13 +2,11 @@
[Group 1]
SHELLS = 1 2
EMIN = -7.6
EMAX = 3.0
EWINDOW = -7.6 3.0
[Group 2]
SHELLS = 3
EMIN = -1.6
EMAX = 2.0
EWINDOW = -1.6 2.0
[Shell 1]
LSHELL = 2
@ -18,8 +16,8 @@ IONS = 5..8
LSHELL = 1
IONS = 1..4
RTRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
TRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0

View File

@ -2,8 +2,7 @@
[Group 1]
SHELLS = 1 2
EMIN = -7.6
EMAX = 3.0
EWINDOW = -7.6 3.0
[Shell 1]
LSHELL = 2
@ -13,9 +12,9 @@ IONS = 5..8
LSHELL = 1
IONS = 1..4
RTRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
TRANSFORM = 0.0 1.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
[Shell 3]
LSHELL = 3

View File

@ -29,7 +29,8 @@ class TestParseGeneral(arraytest.ArrayTestCase):
conf_pars = ConfigParameters(_rpath + 'example.cfg')
conf_pars.parse_general()
res = conf_pars.general
expected = {'basename': 'test_base', 'efermi': 0.1}
expected = {'basename': 'test_base', 'efermi': 0.1,
'dosmesh': {'n_points': 101, 'emin': -8.0, 'emax': 4.0}}
self.assertDictEqual(res, expected)

View File

@ -38,9 +38,9 @@ class TestParseGroups(arraytest.ArrayTestCase):
conf_pars = ConfigParameters(_rpath + 'example.cfg')
conf_pars.parse_groups()
res = conf_pars.groups
expected = [{'index': 1, 'shells': [1, 2], 'emin': -7.6, 'emax': 3.0,
expected = [{'index': 1, 'shells': [1, 2], 'ewindow': (-7.6, 3.0),
'normalize': True, 'normion': False},
{'index': 2, 'shells': [3], 'emin': -1.6, 'emax': 2.0,
{'index': 2, 'shells': [3], 'ewindow': (-1.6, 2.0),
'normalize': True, 'normion': False}]
self.assertListEqual(res, expected)

View File

@ -4,6 +4,7 @@ Test suite for module `inpconf.py`.
import unittest
if __name__ == '__main__':
suite = unittest.TestLoader().discover('./')
# suite = unittest.TestLoader().discover('./')
suite = unittest.TestLoader().discover('./', pattern='test_shells.py')
unittest.TextTestRunner(verbosity=2, buffer=True).run(suite)

View File

@ -77,12 +77,10 @@ class TestParseInput(arraytest.ArrayTestCase):
res += conf_pars.groups.__repr__()
expected = r"""Shells:
[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}, {'tmatrix': array([[ 0., 1., 0.],
[ 1., 0., 0.],
[ 0., 0., 1.]]), 'ion_list': array([0, 1, 2, 3]), 'user_index': 2, 'lshell': 1}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 3, 'lshell': 3}]
[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 2, 'lshell': 1}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 3, 'lshell': 3}]
Groups:
[{'normalize': True, 'index': 1, 'shells': [0, 1], 'normion': False, 'emax': 3.0, 'emin': -7.6}, {'normalize': True, 'index': 2, 'shells': [2], 'normion': False, 'emax': 2.0, 'emin': -1.6}]"""
[{'normalize': True, 'index': 1, 'ewindow': (-7.6, 3.0), 'normion': False, 'shells': [0, 1]}, {'normalize': True, 'index': 2, 'ewindow': (-1.6, 2.0), 'normion': False, 'shells': [2]}]"""
self.assertEqual(res, expected)
@ -104,7 +102,7 @@ Groups:
[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}]
Groups:
[{'normalize': True, 'index': '1', 'emin': -7.6, 'emax': 3.0, 'normion': False, 'shells': [0]}]"""
[{'normalize': True, 'index': '1', 'ewindow': (-7.6, 3.0), 'shells': [0], 'normion': False}]"""
self.assertEqual(res, expected)

View File

@ -58,7 +58,7 @@ class TestParseShells(arraytest.ArrayTestCase):
conf_pars.parse_shells()
res = conf_pars.shells
expected = [{'user_index': 1, 'lshell': 2, 'ion_list': np.array([4, 5, 6, 7])},
{'user_index': 2, 'lshell': 1, 'ion_list': np.array([0, 1, 2, 3]),
{'user_index': 2, 'lshell': 1, 'ion_list': np.array([0, 1, 2, 3]),
'tmatrix': np.array([[ 0., 1., 0.], [ 1., 0., 0.], [ 0., 0., 1.]])}]
# ...lousy way to test equality of two dictionaries containing numpy arrays
self.assertEqual(len(res), len(expected))