|
|
@@ -6,7 +6,7 @@ from .utils import execute, KOSMORRO |
|
|
def test_with_date(): |
|
|
def test_with_date(): |
|
|
for arg in [["-d", "2020-01-27"], ["--date", "2020-01-27"], ["-d2020-01-27"]]: |
|
|
for arg in [["-d", "2020-01-27"], ["--date", "2020-01-27"], ["-d2020-01-27"]]: |
|
|
result = execute(KOSMORRO + arg) |
|
|
result = execute(KOSMORRO + arg) |
|
|
assert result.is_successful() |
|
|
|
|
|
|
|
|
assert result.successful |
|
|
|
|
|
|
|
|
assert ( |
|
|
assert ( |
|
|
result.stdout |
|
|
result.stdout |
|
|
@@ -27,7 +27,7 @@ def test_with_incorrect_date_values(): |
|
|
value = "yolo-yo-lo" |
|
|
value = "yolo-yo-lo" |
|
|
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]: |
|
|
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]: |
|
|
result = execute(KOSMORRO + arg) |
|
|
result = execute(KOSMORRO + arg) |
|
|
assert not result.is_successful() |
|
|
|
|
|
|
|
|
assert not result.successful |
|
|
assert ( |
|
|
assert ( |
|
|
result.stderr |
|
|
result.stderr |
|
|
== f"The date {value} does not match the required YYYY-MM-DD format or the offset format.\n" |
|
|
== f"The date {value} does not match the required YYYY-MM-DD format or the offset format.\n" |
|
|
@@ -36,7 +36,7 @@ def test_with_incorrect_date_values(): |
|
|
value = "2020-13-32" |
|
|
value = "2020-13-32" |
|
|
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]: |
|
|
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]: |
|
|
result = execute(KOSMORRO + arg) |
|
|
result = execute(KOSMORRO + arg) |
|
|
assert not result.is_successful() |
|
|
|
|
|
|
|
|
assert not result.successful |
|
|
assert ( |
|
|
assert ( |
|
|
result.stderr == f"The date {value} is not valid: month must be in 1..12\n" |
|
|
result.stderr == f"The date {value} is not valid: month must be in 1..12\n" |
|
|
) |
|
|
) |
|
|
@@ -45,7 +45,7 @@ def test_with_incorrect_date_values(): |
|
|
def test_with_out_of_range_dates(): |
|
|
def test_with_out_of_range_dates(): |
|
|
for arg in [["-d", "1789-05-05"], ["-d", "3000-01-01"]]: |
|
|
for arg in [["-d", "1789-05-05"], ["-d", "3000-01-01"]]: |
|
|
result = execute(KOSMORRO + arg) |
|
|
result = execute(KOSMORRO + arg) |
|
|
assert not result.is_successful() |
|
|
|
|
|
|
|
|
assert not result.successful |
|
|
assert ( |
|
|
assert ( |
|
|
result.stderr |
|
|
result.stderr |
|
|
== "Moon phase can only be computed between August 9, 1899 and September 26, 2053\nThe date must be between July 28, 1899 and October 8, 2053\n" |
|
|
== "Moon phase can only be computed between August 9, 1899 and September 26, 2053\nThe date must be between July 28, 1899 and October 8, 2053\n" |
|
|
@@ -55,7 +55,7 @@ def test_with_out_of_range_dates(): |
|
|
def test_with_out_of_range_dates_for_moon_phase_only(): |
|
|
def test_with_out_of_range_dates_for_moon_phase_only(): |
|
|
for arg in [["-d", "1899-07-30"], ["-d", "2053-10-06"]]: |
|
|
for arg in [["-d", "1899-07-30"], ["-d", "2053-10-06"]]: |
|
|
result = execute(KOSMORRO + arg) |
|
|
result = execute(KOSMORRO + arg) |
|
|
assert result.is_successful() |
|
|
|
|
|
|
|
|
assert result.successful |
|
|
assert ( |
|
|
assert ( |
|
|
result.stderr |
|
|
result.stderr |
|
|
== "Moon phase can only be computed between August 9, 1899 and September 26, 2053\n" |
|
|
== "Moon phase can only be computed between August 9, 1899 and September 26, 2053\n" |
|
|
|