Skip to content

Commit

Permalink
add test for set_run_modes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Jul 23, 2023
1 parent 6e817a1 commit 4b6bf56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 3 additions & 4 deletions fooof/objs/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,7 @@ def get_run_modes(self):
Dictionary containing the run_modes from the current object.
"""

return {key : getattr(self, key) \
for key in OBJ_DESC['run_modes']}
return {key : getattr(self, key) for key in OBJ_DESC['run_modes']}


def get_meta_data(self):
Expand Down Expand Up @@ -737,7 +736,7 @@ def set_debug_mode(self, debug):

self._debug = debug


def set_check_modes(self, check_freqs=None, check_data=None):
"""Set check modes, which controls if an error is raised based on check on the inputs.
Expand Down Expand Up @@ -780,7 +779,7 @@ def set_run_modes(self, debug, check_freqs, check_data):
check_data : bool
Whether to run in check data mode.
"""

self.set_debug_mode(debug)
self.set_check_modes(check_freqs, check_data)

Expand Down
2 changes: 0 additions & 2 deletions fooof/tests/core/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_get_description(tfm):
for it in va:
assert it in objs


def test_get_peak_indices():

indices = get_peak_indices()
Expand All @@ -33,7 +32,6 @@ def test_get_ap_indices():
for ind, val in enumerate(['offset', 'exponent']):
assert indices_fixed[val] == ind


indices_knee = get_indices('knee')

assert indices_knee
Expand Down
7 changes: 7 additions & 0 deletions fooof/tests/objs/test_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,13 @@ def test_fooof_set_check_modes(tfm):
assert tfm._check_freqs is True
assert tfm._check_data is True

def test_set_run_modes():

tfm = FOOOF(verbose=False)
tfm.set_run_modes(False, False, False)
for field in OBJ_DESC['run_modes']:
assert getattr(tfm, field) is False

def test_fooof_to_df(tfm, tbands, skip_if_no_pandas):

df1 = tfm.to_df(2)
Expand Down

0 comments on commit 4b6bf56

Please sign in to comment.