mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 04:13:47 +01:00
* Added Scenario 3 to 'test_parse_input()' (test9.cfg)
* Fixed 'parse_input()' to pass the test
This commit is contained in:
parent
8928fa3118
commit
bcc20a0399
@ -374,7 +374,7 @@ class ConfigParameters:
|
||||
def find_shell_by_user_index(uindex):
|
||||
for ind, shell in enumerate(self.shells):
|
||||
if shell['user_index'] == uindex:
|
||||
return shell
|
||||
return ind, shell
|
||||
raise KeyError
|
||||
|
||||
sh_inds = []
|
||||
@ -384,7 +384,7 @@ class ConfigParameters:
|
||||
try:
|
||||
ind, shell = find_shell_by_user_index(user_ind)
|
||||
except KeyError:
|
||||
raise Exception("Shell %i reference in group '%s' does not exist"%(user_ind, group['index']))
|
||||
raise Exception("Shell %i referenced in group '%s' does not exist"%(user_ind, group['index']))
|
||||
sh_inds.append(ind)
|
||||
|
||||
# If [Shell] section contains (potentiall conflicting) group parameters
|
||||
|
25
python/converters/vasp/test/inpconf/test9.cfg
Normal file
25
python/converters/vasp/test/inpconf/test9.cfg
Normal file
@ -0,0 +1,25 @@
|
||||
[General]
|
||||
|
||||
[Group 1]
|
||||
SHELLS = 1 2
|
||||
EMIN = -7.6
|
||||
EMAX = 3.0
|
||||
|
||||
[Group 2]
|
||||
SHELLS = 3
|
||||
EMIN = -1.6
|
||||
EMAX = 2.0
|
||||
|
||||
[Shell 1]
|
||||
LSHELL = 2
|
||||
IONS = 5..8
|
||||
|
||||
[Shell 2]
|
||||
LSHELL = 1
|
||||
IONS = 1..4
|
||||
|
||||
RTRANSFORM = 0.0 1.0 0.0
|
||||
1.0 0.0 0.0
|
||||
0.0 0.0 1.0
|
||||
|
||||
|
@ -311,6 +311,12 @@ class TestSpecialParsers(unittest.TestCase):
|
||||
with self.assertRaisesRegexp(KeyError, err_mess):
|
||||
conf_pars.parse_input()
|
||||
|
||||
# Scenario 3
|
||||
conf_pars = ConfigParameters('test9.cfg')
|
||||
err_mess = "Shell 3 referenced in"
|
||||
with self.assertRaisesRegexp(Exception, err_mess):
|
||||
conf_pars.parse_input()
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user