Skip to content

Commit

Permalink
fix SonarQube complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe committed Sep 30, 2024
1 parent 7662455 commit ce166ed
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,15 @@ def test_filename_does_not_match_template():
template = "{init?fmt=%Y%m%d%H}_dog_A{lead?fmt=%HH}h"
filepath = "1987020103_cat_A03h"
out = parse_template(template, filepath)
assert out == None
assert out is None


@pytest.mark.util
def test_filename_does_not_match_template_end():
template = "{init?fmt=%Y%m%d%H}_dog_A{lead?fmt=%HH}h"
filepath = "1987020103_dog_A03d"
out = parse_template(template, filepath)
assert out == None
assert out is None


@pytest.mark.util
Expand All @@ -379,7 +379,7 @@ def test_get_tags():
# value is the formatted output string, like 01
# ttype is the unit to check, i.e. 'H', 'M', 'S', 'd', 's'
@pytest.mark.parametrize(
'format, key, value, ttype', [
'fmt, key, value, ttype', [
('H', 1, '01', 'H'),
('1H', 1, '1', 'H'),
('2H', 1, '01', 'H'),
Expand Down Expand Up @@ -418,15 +418,15 @@ def test_get_tags():
]
)
@pytest.mark.util
def test_format_one_time_item(format, key ,value, ttype):
assert format_one_time_item(format, key, ttype) == value
def test_format_one_time_item(fmt, key ,value, ttype):
assert format_one_time_item(fmt, key, ttype) == value


# format is the time format to use, like, %M or %H%M
# seconds is the integer number of seconds of the offset to use, i.e. 3601
# value is the formatted output string, like 010001
@pytest.mark.parametrize(
'format, seconds, value', [
'fmt, seconds, value', [
('%H', 1, '00'),
('%M', 1, '00'),
('%S', 1, '01'),
Expand All @@ -448,9 +448,9 @@ def test_format_one_time_item(format, key ,value, ttype):
]
)
@pytest.mark.util
def test_format_hms(format, seconds, value):
def test_format_hms(fmt, seconds, value):
# format should be something like %M or %H%M
assert format_hms(format, seconds == value)
assert format_hms(fmt, seconds == value)


@pytest.mark.util
Expand Down Expand Up @@ -539,7 +539,6 @@ def test_populate_match_dict(template, filepath, expected_match_dict, expected_v
elif match_dict is None:
# if expected is not None, fail if actual is None
assert False
return

num_keys = len(match_dict.keys())
expected_num_keys = len(expected_match_dict.keys())
Expand All @@ -562,8 +561,6 @@ def test_populate_match_dict(template, filepath, expected_match_dict, expected_v
print(f"Incorrect valid shift. Actual {valid_shift}, Expected: {expected_valid_shift}")
assert False

assert True

except TypeError:
assert expected_match_dict is None and expected_valid_shift is None

Expand Down Expand Up @@ -591,8 +588,6 @@ def test_get_fmt_info(fmt, filepath, identifier, expected_fmt_len, expected_matc
print(f"Expected Dictionary: {expected_match_dict}")
assert False

assert True


@pytest.mark.parametrize(
'templ, expected_filename', [
Expand Down

0 comments on commit ce166ed

Please sign in to comment.