diff --git a/test/plovasp/inpconf/test_input.py b/test/plovasp/inpconf/test_input.py index 1bd589ce..c02b45ed 100644 --- a/test/plovasp/inpconf/test_input.py +++ b/test/plovasp/inpconf/test_input.py @@ -78,9 +78,9 @@ class TestParseInput(arraytest.ArrayTestCase): res = res.replace(" ","") # Remove spaces for comparison expected = r"""Shells: -[{'ion_list':array([4,5,6,7]),'user_index':1,'lshell':2},{'tmatrix':array([[0.,1.,0.], +[{'ions':{'nion':4,'ion_list':[[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}] +[0.,0.,1.]]),'ions':{'nion':4,'ion_list':[[0],[1],[2],[3]]},'user_index':2,'lshell':1},{'ions':{'nion':4,'ion_list':[[0],[1],[2],[3]]},'user_index':3,'lshell':3}] Groups: [{'normalize':True,'index':1,'ewindow':(-7.6,3.0),'normion':True,'shells':[0,1]},{'normalize':True,'index':2,'ewindow':(-1.6,2.0),'normion':True,'shells':[2]}]""" @@ -103,7 +103,7 @@ Groups: res = res.replace(" ","") # Remove spaces for comparison expected = r"""Shells: -[{'ion_list':array([4,5,6,7]),'user_index':1,'lshell':2}] +[{'ions':{'nion':4,'ion_list':[[4],[5],[6],[7]]},'user_index':1,'lshell':2}] Groups: [{'normalize':True,'index':'1','ewindow':(-7.6,3.0),'shells':[0],'normion':True}]""" @@ -111,3 +111,7 @@ Groups: self.assertEqual(res, expected) +if __name__ == '__main__': + import unittest + unittest.main(verbosity=2, buffer=False) + diff --git a/test/plovasp/inpconf/test_shells.py b/test/plovasp/inpconf/test_shells.py index e4d3faa9..23cf0704 100644 --- a/test/plovasp/inpconf/test_shells.py +++ b/test/plovasp/inpconf/test_shells.py @@ -57,19 +57,19 @@ class TestParseShells(arraytest.ArrayTestCase): conf_pars = ConfigParameters(_rpath + 'parse_shells_4.cfg') 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]), + expected = [{'user_index': 1, 'lshell': 2, 'ions': {'nion': 4, 'ion_list': [[4],[5],[6],[7]]}}, + {'user_index': 2, 'lshell': 1, 'ions': {'nion': 4, 'ion_list': [[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)) - arr = res[0].pop('ion_list') - arr_exp = expected[0].pop('ion_list') - self.assertEqual(arr, arr_exp) + arr = res[0].pop('ions') + arr_exp = expected[0].pop('ions') + self.assertDictEqual(arr, arr_exp) - arr = res[1].pop('ion_list') - arr_exp = expected[1].pop('ion_list') - self.assertEqual(arr, arr_exp) + arr = res[1].pop('ions') + arr_exp = expected[1].pop('ions') + self.assertDictEqual(arr, arr_exp) arr = res[1].pop('tmatrix') arr_exp = expected[1].pop('tmatrix') @@ -78,3 +78,7 @@ class TestParseShells(arraytest.ArrayTestCase): self.assertListEqual(res, expected) +if __name__ == '__main__': + import unittest + unittest.main(verbosity=2, buffer=False) + diff --git a/test/plovasp/inpconf/test_special_parsers.py b/test/plovasp/inpconf/test_special_parsers.py index e7d52ec2..64f5ee36 100644 --- a/test/plovasp/inpconf/test_special_parsers.py +++ b/test/plovasp/inpconf/test_special_parsers.py @@ -60,11 +60,12 @@ class TestParseStringIonList(arraytest.ArrayTestCase): Scenarios: - - **if** par_str == '5 6 7 8' **return** array([4, 5, 6, 7]) + - **if** par_str == '5 6 7 8' **return** 'ions' with ion_list = [[4], [5], [6], [7]] - **if** par_str == 'Ni' **raise** NotImplementedError - **if** par_str == '0 1' **raise** AssertionError - - **if** par_str == '5..8' **return** array([4, 5, 6, 7]) + - **if** par_str == '5..8' **return** 'ions' with ion_list = [[4], [5], [6], [7]] - **if** par_str == '8..5' **raise** AssertionError + - **if** par_str == '[5, 8] [6 7]' **return** 'ions' with ion_list = [[4, 7], [5, 6]] """ def setUp(self): """ @@ -74,9 +75,9 @@ class TestParseStringIonList(arraytest.ArrayTestCase): # Scenario 1 def test_simple_list(self): - expected = np.array([4, 5, 6, 7]) + expected = {'nion': 4, 'ion_list': [[4], [5], [6], [7]]} res = self.cpars.parse_string_ion_list('5 6 7 8') - self.assertEqual(res, expected) + self.assertDictEqual(res, expected) # Scenario 2 def test_atomic_symbol(self): @@ -91,9 +92,9 @@ class TestParseStringIonList(arraytest.ArrayTestCase): # Scenario 4 def test_list_range(self): - expected = np.array([4, 5, 6, 7]) + expected = {'nion': 4, 'ion_list': [[4], [5], [6], [7]]} res = self.cpars.parse_string_ion_list('5..8') - self.assertEqual(res, expected) + self.assertDictEqual(res, expected) # Scenario 5 def test_range_wrong_order(self): @@ -294,3 +295,7 @@ class TestParseStringDosmesh(arraytest.ArrayTestCase): self.cpars.parse_string_dosmesh('8.0') +if __name__ == '__main__': + import unittest + unittest.main(verbosity=2, buffer=False) + diff --git a/test/plovasp/plotools/example.cfg b/test/plovasp/plotools/example.cfg index 6158ea30..a7cd544d 100644 --- a/test/plovasp/plotools/example.cfg +++ b/test/plovasp/plotools/example.cfg @@ -1,8 +1,7 @@ [Shell 1] LSHELL = 2 -IONS = 1 -EMIN = -15.0 -EMAX = 5.0 +IONS = 2 +EWINDOW = -15.0 5.0 diff --git a/test/plovasp/plotools/runtest.sh b/test/plovasp/plotools/runtest.sh index 9b7bd8ca..4ceb1ca0 100755 --- a/test/plovasp/plotools/runtest.sh +++ b/test/plovasp/plotools/runtest.sh @@ -1 +1 @@ -PYTHONPATH=../../python:../../c:$PYTHONPATH python $1 +PYTHONPATH=../../python:../../c:$PYTHONPATH ../../../build_pytriqs $1 diff --git a/test/plovasp/proj_shell/projshells.out b/test/plovasp/proj_shell/projshells.out index 138f015a..2ad13508 100644 --- a/test/plovasp/proj_shell/projshells.out +++ b/test/plovasp/proj_shell/projshells.out @@ -1,4 +1,4 @@ -pars: {'ion_list': array([1]), 'user_index': 1, 'lshell': 2} +pars: {'ions': {'nion': 1, 'ion_list': [[1]]}, 'user_index': 1, 'lshell': 2} 10 25 1 0.000000 -0.000000 2 0.000000 0.000000