1313
1414FLAVOR_MINIMAL_CONFIG = {
1515 "name" : "scf" ,
16+ "executableId" : "exe_123" ,
1617}
1718
1819FLAVOR_FULL_CONFIG = {
3233
3334FLAVOR_TO_DICT_CONFIG = {
3435 "name" : "scf" ,
36+ "executableId" : "exe_123" ,
3537 "executableName" : "pw.x" ,
3638 "applicationName" : "espresso" ,
3739}
3840
3941FLAVOR_FROM_DICT_CONFIG = {
4042 "name" : "scf" ,
43+ "executableId" : "exe_123" ,
4144 "executableName" : "pw.x" ,
4245 "applicationName" : "espresso" ,
4346 "input" : [{"name" : "pw_scf.in" , "templateName" : "pw_scf" }],
4649
4750FLAVOR_WITH_EXTRA_FIELDS_CONFIG = {
4851 "name" : "scf" ,
52+ "executableId" : "exe_123" ,
4953 "custom_field" : "custom_value" ,
5054}
5155
56+ EXPECTED_FLAVOR_TO_DICT = {
57+ "executableId" : "exe_123" ,
58+ "executableName" : "pw.x" ,
59+ "applicationName" : "espresso" ,
60+ "input" : [],
61+ "schemaVersion" : "2022.8.16" ,
62+ "name" : "scf" ,
63+ "isDefault" : False ,
64+ }
65+
5266
5367def test_flavor_input_creation ():
5468 config = FLAVOR_INPUT_MINIMAL_CONFIG
@@ -84,8 +98,8 @@ def test_flavor_with_all_fields():
8498def test_flavor_to_dict ():
8599 config = FLAVOR_TO_DICT_CONFIG
86100 flavor = Flavor (** config )
87- expected = { ** config }
88- assertion . assert_deep_almost_equal ( expected , flavor . model_dump ( exclude_unset = True ))
101+ assertion . assert_deep_almost_equal ( EXPECTED_FLAVOR_TO_DICT , flavor . to_dict ())
102+
89103
90104
91105def test_flavor_from_dict ():
@@ -99,4 +113,6 @@ def test_flavor_with_extra_fields():
99113 config = FLAVOR_WITH_EXTRA_FIELDS_CONFIG
100114 flavor = Flavor (** config )
101115 assert flavor .name == "scf"
102- assert not hasattr (flavor , "custom_field" )
116+ assert hasattr (flavor , "custom_field" )
117+ assert flavor .custom_field == "custom_value"
118+ assert "custom_field" in flavor .to_dict ()
0 commit comments