From 5b32006e65756f02d2dbdb018ff8baabf81e4d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Wed, 12 Apr 2023 16:27:05 +0200 Subject: [PATCH] chore: fix tests --- tests/dates.py | 4 ++-- tests/general.py | 8 +++----- tests/position.py | 24 ++++++++++++------------ tests/timezone.py | 8 ++++---- tests/utils.py | 2 +- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/dates.py b/tests/dates.py index 2e6f0a9..eb96f31 100644 --- a/tests/dates.py +++ b/tests/dates.py @@ -13,10 +13,10 @@ def test_with_date(): == """Monday, January 27, 2020 Moon phase: New Moon -First Quarter on Sunday, February 2, 2020 at 1:41 AM +First Quarter on Sunday, February 2, 2020 at 1:41 AM Expected events: -8:00 PM Venus and Neptune are in conjunction +8:00 PM Venus and Neptune are in conjunction Note: All the hours are given in UTC. """ diff --git a/tests/general.py b/tests/general.py index c7f8462..33971dd 100644 --- a/tests/general.py +++ b/tests/general.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from sys import version_info +from sys import version_info as python_version from .utils import ( execute, KOSMORRO, @@ -19,7 +19,7 @@ def test_run_without_argument(): print(stdout) # It always starts with the current date, an empty line and the current and next Moon date: - assert stdout[0] == format_date(date.today(), "full") + assert stdout[0] == format_date(date.today(), "full", "EN") assert stdout[1] == "" assert CURRENT_MOON_PHASE_PATTERN.match(stdout[2]) assert NEXT_MOON_PHASE_PATTERN.match(stdout[3]) @@ -31,15 +31,13 @@ def test_run_without_argument(): def test_help_message(): - python_version = (version_info.major, version_info.minor) - for arg in ["--help", "-h"]: result = execute(KOSMORRO + [arg]) assert result.is_successful() # Options header has changed from "optional arguments" to "options" in Python 3.10. options_header = ( - "options" if python_version == (3, 10) else "optional arguments" + "optional arguments" if python_version.minor < 10 else "options" ) assert ( diff --git a/tests/position.py b/tests/position.py index 1912d1a..2f4f32c 100644 --- a/tests/position.py +++ b/tests/position.py @@ -14,22 +14,22 @@ def check_command_return(result): Object Rise time Culmination time Set time -------- ----------- ------------------ ---------- -Sun 7:31 AM 12:01 PM 4:30 PM -Moon 9:06 AM 2:09 PM 7:13 PM -Mercury 8:10 AM 12:49 PM 5:28 PM -Venus 9:01 AM 2:35 PM 8:10 PM -Mars 4:19 AM 8:23 AM 12:28 PM -Jupiter 6:15 AM 10:18 AM 2:21 PM -Saturn 6:56 AM 11:09 AM 3:22 PM -Uranus 10:21 AM 5:25 PM 12:33 AM -Neptune 9:01 AM 2:36 PM 8:10 PM -Pluto 6:57 AM 11:04 AM 3:11 PM +Sun 7:31 AM 12:01 PM 4:30 PM +Moon 9:06 AM 2:09 PM 7:13 PM +Mercury 8:10 AM 12:49 PM 5:28 PM +Venus 9:01 AM 2:35 PM 8:10 PM +Mars 4:19 AM 8:23 AM 12:28 PM +Jupiter 6:15 AM 10:18 AM 2:21 PM +Saturn 6:56 AM 11:09 AM 3:22 PM +Uranus 10:21 AM 5:25 PM 12:33 AM +Neptune 9:01 AM 2:36 PM 8:10 PM +Pluto 6:57 AM 11:04 AM 3:11 PM Moon phase: New Moon -First Quarter on Sunday, February 2, 2020 at 1:41 AM +First Quarter on Sunday, February 2, 2020 at 1:41 AM Expected events: -8:00 PM Venus and Neptune are in conjunction +8:00 PM Venus and Neptune are in conjunction Note: All the hours are given in UTC. """ diff --git a/tests/timezone.py b/tests/timezone.py index 4972fd4..47ee0bb 100644 --- a/tests/timezone.py +++ b/tests/timezone.py @@ -13,10 +13,10 @@ def check_command_return_t_plus_one(result): == """Monday, January 27, 2020 Moon phase: New Moon -First Quarter on Sunday, February 2, 2020 at 2:41 AM +First Quarter on Sunday, February 2, 2020 at 2:41 AM Expected events: -9:00 PM Venus and Neptune are in conjunction +9:00 PM Venus and Neptune are in conjunction Note: All the hours are given in the UTC+1 timezone. """ @@ -30,10 +30,10 @@ def check_command_return_t_minus_one(result): == """Monday, January 27, 2020 Moon phase: New Moon -First Quarter on Sunday, February 2, 2020 at 12:41 AM +First Quarter on Sunday, February 2, 2020 at 12:41 AM Expected events: -7:00 PM Venus and Neptune are in conjunction +7:00 PM Venus and Neptune are in conjunction Note: All the hours are given in the UTC-1 timezone. """ diff --git a/tests/utils.py b/tests/utils.py index d9eb5d7..4327d0d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -26,7 +26,7 @@ NEXT_MOON_PHASE_PATTERN = re.compile( r"on ((Monday)|(Tuesday)|(Wednesday)|(Thursday)|(Friday)|(Saturday)|(Sunday)), " r"((January)|(February)|(March)|(April)|(May)|(June)|" r"(July)|(August)|(September)|(October)|(November)|(December)) " - r"[0-9]{1,2}, [0-9]{4} at [0-9]{1,2}:[0-9]{2} [AP]M$" + r"[0-9]{1,2}, [0-9]{4} at [0-9]{1,2}:[0-9]{2} [AP]M$" )