1313 _parse_config_file ,
1414 _parse_config
1515)
16+ from chipflow_lib .config_model import Config , ChipFlowConfig
1617
1718
1819class TestCoreUtilities (unittest .TestCase ):
@@ -104,16 +105,16 @@ def test_parse_config_file_valid(self):
104105
105106 config = _parse_config_file (config_path )
106107
107- self . assertIn ( "chipflow" , config )
108- self .assertEqual (config [ " chipflow" ][ " project_name" ] , "test_project" )
109- self .assertEqual (config [ " chipflow" ][ " silicon" ][ " process" ] , "sky130" )
108+ assert config . chipflow
109+ self .assertEqual (config . chipflow . project_name , "test_project" )
110+ self .assertEqual (config . chipflow . silicon . process , "sky130" )
110111
111112 @mock .patch ("chipflow_lib._ensure_chipflow_root" )
112113 @mock .patch ("chipflow_lib._parse_config_file" )
113114 def test_parse_config (self , mock_parse_config_file , mock_ensure_chipflow_root ):
114115 """Test _parse_config which uses _ensure_chipflow_root and _parse_config_file"""
115116 mock_ensure_chipflow_root .return_value = "/mock/chipflow/root"
116- mock_parse_config_file .return_value = { " chipflow" : { " test" : "value" }}
117+ mock_parse_config_file .return_value = Config ( chipflow = ChipFlowConfig ( project_name = 'test' , top = { ' test' , 'test' }))
117118
118119 config = _parse_config ()
119120
@@ -123,4 +124,5 @@ def test_parse_config(self, mock_parse_config_file, mock_ensure_chipflow_root):
123124 if hasattr (mock_parse_config_file .call_args [0 ][0 ], 'as_posix' )
124125 else mock_parse_config_file .call_args [0 ][0 ],
125126 "/mock/chipflow/root/chipflow.toml" )
126- self .assertEqual (config , {"chipflow" : {"test" : "value" }})
127+ self .assertEqual (config .chipflow .project_name , "test" )
128+ self .assertEqual (config .chipflow .project_name .top , {'test' : 'test' })
0 commit comments