Skip to content

Commit

Permalink
issue warning only when truncation is performed
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkilic committed May 8, 2024
1 parent 4af4044 commit e9c9f57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion efel/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def set_setting(self,
converted_value,
expected_type.__name__
)
if expected_type is int and isinstance(new_value, float):
if expected_type is int and isinstance(new_value, float) and \
new_value != converted_value:
logger.warning(log_message)
else:
logger.debug(log_message)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ def test_save_feature(filename, index):

assert os.path.exists(filename)
loaded_data = load_data(filename)
print(feature_values)
print(loaded_data)
for key in feature_values.keys():
if feature_values[key] is not None and loaded_data[key]:
assert np.allclose(feature_values[key],
Expand Down
3 changes: 2 additions & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def test_set_setting():
@pytest.mark.parametrize("setting_name, new_value, converted_value, expected_type", [
("Threshold", "-30.0", -30.0, float),
("strict_stiminterval", 0, False, bool),
("initburst_freq_threshold", -50.9, -50, int)
("initburst_freq_threshold", -50.9, -50, int),
("initburst_sahp_start", 5.5, 5, int)
])
def test_set_setting_conversion(caplog,
setting_name,
Expand Down

0 comments on commit e9c9f57

Please sign in to comment.