1+ from  unittest .mock  import  patch 
2+ 
13import  pytest 
24
35from  ingredient_parser ._common  import  (
46    consume ,
57    group_consecutive_idx ,
68    is_float ,
79    is_range ,
10+     show_model_card ,
811)
912
1013
@@ -87,7 +90,7 @@ def test_x(self):
8790        assert  not  is_range ("1x" )
8891
8992
90- class  TestPostProcessor_group_consecutive_indices :
93+ class  Test_group_consecutive_indices :
9194    def  test_single_group (self ):
9295        """ 
9396        Return single group 
@@ -103,3 +106,18 @@ def test_multiple_groups(self):
103106        input_indices  =  [0 , 1 , 2 , 4 , 5 , 6 , 8 , 9 ]
104107        groups  =  group_consecutive_idx (input_indices )
105108        assert  [list (g ) for  g  in  groups ] ==  [[0 , 1 , 2 ], [4 , 5 , 6 ], [8 , 9 ]]
109+ 
110+ 
111+ class  Test_show_model_card :
112+     @patch ("os.startfile" , create = True ) 
113+     @patch ("subprocess.call" ) 
114+     def  test_model_card_found (self , mock_startfile , mock_subprocess_call ):
115+         """Test model card found at path derived from selected language. 
116+ 
117+         The calls to os.startfile and subprocess.call are mocked to prevent the model 
118+         card from actually opening. 
119+         """ 
120+         try :
121+             show_model_card ("en" )
122+         except  FileNotFoundError :
123+             pytest .fail ("Model card not found." )
0 commit comments