Skip to content

Commit

Permalink
Merge pull request #797 from robbrad/795_unit_test_coverage
Browse files Browse the repository at this point in the history
fix: #795 Unit Test Coverage
  • Loading branch information
robbrad authored Sep 3, 2024
2 parents 0227f89 + 030d0ea commit 43a989b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ parity-check:

unit-tests:
poetry run coverage erase
poetry run coverage run --append --omit "*/tests/*" -m pytest uk_bin_collection/tests --ignore=uk_bin_collection/tests/step_defs/
- poetry run coverage run --append --omit "*/tests/*" -m pytest uk_bin_collection/tests --ignore=uk_bin_collection/tests/step_defs/
poetry run coverage xml

update-wiki:
Expand Down
14 changes: 7 additions & 7 deletions uk_bin_collection/tests/test_common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,17 @@ def test_string_with_whitespace_and_numbers():
(
"2024-09-02",
"Tuesday",
"03/09/2024",
"09/03/2024",
), # Today is Monday, next Tuesday is tomorrow
(
"2024-09-02",
"Sunday",
"08/09/2024",
"09/08/2024",
), # Today is Monday, next Sunday is in 6 days
(
"2024-09-03",
"Wednesday",
"04/09/2024",
"09/04/2024",
), # Today is Tuesday, next Wednesday is tomorrow
(
"2024-09-03",
Expand All @@ -430,8 +430,8 @@ def test_string_with_whitespace_and_numbers():
)
def test_get_next_day_of_week(today_str, day_name, expected):
mock_today = datetime.strptime(today_str, "%Y-%m-%d")
with patch("datetime.datetime") as mock_datetime:
with patch('uk_bin_collection.common.datetime') as mock_datetime: # replace 'your_module' with the actual module name
mock_datetime.now.return_value = mock_today
mock_datetime.strptime = datetime.strptime # to handle strptime within patch
result = get_next_day_of_week(day_name)
assert result == expected
mock_datetime.side_effect = lambda *args, **kw: datetime(*args, **kw)
result = get_next_day_of_week(day_name, date_format="%m/%d/%Y")
assert result == expected
2 changes: 1 addition & 1 deletion uk_bin_collection/uk_bin_collection/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def save_data(file_path, data):
json.dump(data, file, sort_keys=True, indent=4)


def get_next_day_of_week(day_name):
def get_next_day_of_week(day_name, date_format="%d/%m/%Y"):
days_of_week = [
"Monday",
"Tuesday",
Expand Down

0 comments on commit 43a989b

Please sign in to comment.