@@ -414,17 +414,24 @@ def test_fooof_debug():
414414 with raises (FitError ):
415415 tfm .fit (* gen_power_spectrum ([3 , 50 ], [50 , 2 ], [10 , 0.5 , 2 , 20 , 0.3 , 4 ]))
416416
417- def test_fooof_check_data ():
418- """Test FOOOF in with check data mode turned off, including with NaN data."""
417+ def test_fooof_set_check_modes (tfm ):
418+ """Test changing check_modes using set_check_modes, and that checks get turned off.
419+ Note that testing for checks raising errors happens in test_fooof_checks.`"""
419420
420421 tfm = FOOOF (verbose = False )
421422
422- tfm .set_check_data_mode (False )
423+ tfm .set_check_modes (False , False )
424+ assert tfm ._check_freqs is False
423425 assert tfm ._check_data is False
424426
425- # Add data, with check data turned off
426- # In check data mode, adding data with NaN should run
427- freqs = gen_freqs ([3 , 50 ], 0.5 )
427+ # Add bad frequency data, with check freqs turned off
428+ freqs = np .array ([1 , 2 , 4 ])
429+ powers = np .array ([1 , 2 , 3 ])
430+ tfm .add_data (freqs , powers )
431+ assert tfm .has_data
432+
433+ # Add bad power values data, with check data turned off
434+ freqs = gen_freqs ([3 , 30 ], 1 )
428435 powers = np .ones_like (freqs ) * np .nan
429436 tfm .add_data (freqs , powers )
430437 assert tfm .has_data
@@ -433,6 +440,11 @@ def test_fooof_check_data():
433440 tfm .fit ()
434441 assert not tfm .has_model
435442
443+ # Reset check modes to true
444+ tfm .set_check_modes (True , True )
445+ assert tfm ._check_freqs is True
446+ assert tfm ._check_data is True
447+
436448def test_fooof_to_df (tfm , tbands , skip_if_no_pandas ):
437449
438450 df1 = tfm .to_df (2 )
0 commit comments