File tree Expand file tree Collapse file tree
tests/python_package_test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,22 +271,25 @@ def test_add_features_throws_if_num_data_unequal(rng):
271271 X2 = rng .uniform (size = (10 , 1 ))
272272 d1 = lgb .Dataset (X1 ).construct ()
273273 d2 = lgb .Dataset (X2 ).construct ()
274- with pytest .raises (lgb .basic .LightGBMError ):
274+ with pytest .raises (
275+ lgb .basic .LightGBMError , match = "Cannot add features from other Dataset with a different number of rows"
276+ ):
275277 d1 .add_features_from (d2 )
276278
277279
278280def test_add_features_throws_if_datasets_unconstructed (rng ):
279281 X1 = rng .uniform (size = (100 , 1 ))
280282 X2 = rng .uniform (size = (100 , 1 ))
281- with pytest .raises (ValueError ):
283+ err_msg = "Both source and target Datasets must be constructed before adding features"
284+ with pytest .raises (ValueError , match = err_msg ):
282285 d1 = lgb .Dataset (X1 )
283286 d2 = lgb .Dataset (X2 )
284287 d1 .add_features_from (d2 )
285- with pytest .raises (ValueError ):
288+ with pytest .raises (ValueError , match = err_msg ):
286289 d1 = lgb .Dataset (X1 ).construct ()
287290 d2 = lgb .Dataset (X2 )
288291 d1 .add_features_from (d2 )
289- with pytest .raises (ValueError ):
292+ with pytest .raises (ValueError , match = err_msg ):
290293 d1 = lgb .Dataset (X1 )
291294 d2 = lgb .Dataset (X2 ).construct ()
292295 d1 .add_features_from (d2 )
You can’t perform that action at this time.
0 commit comments