@@ -1013,6 +1013,43 @@ def test_proc_val(self):
10131013 assert Incar .proc_val ("LREAL" , "Auto" ) == "Auto"
10141014 assert Incar .proc_val ("LREAL" , "on" ) == "On"
10151015
1016+ def test_proc_val_inconsistent_type (self ):
1017+ """proc_val should not raise even when value conflicts with expected type."""
1018+
1019+ bool_values = ["T" , ".FALSE." ]
1020+ int_values = ["5" , "-3" ]
1021+ float_values = ["1.23" , "-4.56e-2" ]
1022+ list_values = ["3*1.0 2*0.5" , "1 2 3" ]
1023+ str_values = ["Auto" , "Run" , "Hello" ]
1024+
1025+ # Expect bool
1026+ for v in int_values + float_values + list_values + str_values :
1027+ assert Incar .proc_val ("LASPH" , v ) is not None
1028+
1029+ # Expect int
1030+ for v in bool_values + float_values + list_values + str_values :
1031+ assert Incar .proc_val ("LORBIT" , v ) is not None
1032+
1033+ # Expect float
1034+ for v in bool_values + int_values + list_values + str_values :
1035+ assert Incar .proc_val ("ENCUT" , v ) is not None
1036+
1037+ # Expect str
1038+ for v in bool_values + int_values + float_values + list_values :
1039+ assert Incar .proc_val ("ALGO" , v ) is not None
1040+
1041+ # Expect list
1042+ for v in bool_values + int_values + float_values + str_values :
1043+ assert Incar .proc_val ("PHON_TLIST" , v ) is not None
1044+
1045+ # Union type (bool | str)
1046+ for v in int_values + float_values + list_values :
1047+ assert Incar .proc_val ("LREAL" , v ) is not None
1048+
1049+ # Non-existent
1050+ for v in int_values + float_values + list_values + str_values + bool_values :
1051+ assert Incar .proc_val ("HELLOWORLD" , v ) is not None
1052+
10161053 def test_check_params (self ):
10171054 # Triggers warnings when running into invalid parameters
10181055 incar = Incar (
0 commit comments