Ver a proveniência

tests: fix `is_successful()` deprecation

pull/415/head
Jérôme Deuchnord há 2 meses
ascendente
cometimento
bce4671a78
5 ficheiros alterados com 11 adições e 11 eliminações
  1. +5
    -5
      tests/dates.py
  2. +2
    -2
      tests/general.py
  3. +1
    -1
      tests/output.py
  4. +1
    -1
      tests/position.py
  5. +2
    -2
      tests/timezone.py

+ 5
- 5
tests/dates.py Ver ficheiro

@@ -6,7 +6,7 @@ from .utils import execute, KOSMORRO
def test_with_date():
for arg in [["-d", "2020-01-27"], ["--date", "2020-01-27"], ["-d2020-01-27"]]:
result = execute(KOSMORRO + arg)
assert result.is_successful()
assert result.successful

assert (
result.stdout
@@ -27,7 +27,7 @@ def test_with_incorrect_date_values():
value = "yolo-yo-lo"
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]:
result = execute(KOSMORRO + arg)
assert not result.is_successful()
assert not result.successful
assert (
result.stderr
== 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"
for arg in [["-d", value], ["--date", value], [f"-d{value}"]]:
result = execute(KOSMORRO + arg)
assert not result.is_successful()
assert not result.successful
assert (
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():
for arg in [["-d", "1789-05-05"], ["-d", "3000-01-01"]]:
result = execute(KOSMORRO + arg)
assert not result.is_successful()
assert not result.successful
assert (
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"
@@ -55,7 +55,7 @@ def test_with_out_of_range_dates():
def test_with_out_of_range_dates_for_moon_phase_only():
for arg in [["-d", "1899-07-30"], ["-d", "2053-10-06"]]:
result = execute(KOSMORRO + arg)
assert result.is_successful()
assert result.successful
assert (
result.stderr
== "Moon phase can only be computed between August 9, 1899 and September 26, 2053\n"


+ 2
- 2
tests/general.py Ver ficheiro

@@ -13,7 +13,7 @@ from babel.dates import format_date

def test_run_without_argument():
result = execute(KOSMORRO)
assert result.is_successful()
assert result.successful

stdout = result.stdout.split("\n")
print(stdout)
@@ -34,7 +34,7 @@ def test_help_message():
for arg in ["--help", "-h"]:
result = execute(KOSMORRO + [arg])

assert result.is_successful()
assert result.successful

if python_version.major == 3 and python_version.minor < 13:
assert (


+ 1
- 1
tests/output.py Ver ficheiro

@@ -13,7 +13,7 @@ def test_json_output():
result = execute(
KOSMORRO + ["--position=50.5876,3.0624", "-d2020-01-27", "--format=json"]
)
assert result.is_successful()
assert result.successful
assert (
result.stdout
== """{


+ 1
- 1
tests/position.py Ver ficheiro

@@ -7,7 +7,7 @@ from .utils import (


def check_command_return(result):
assert result.is_successful()
assert result.successful
assert (
result.stdout
== """Monday, January 27, 2020


+ 2
- 2
tests/timezone.py Ver ficheiro

@@ -7,7 +7,7 @@ from .utils import (


def check_command_return_t_plus_one(result):
assert result.is_successful()
assert result.successful
assert (
result.stdout
== """Monday, January 27, 2020
@@ -24,7 +24,7 @@ Note: All the hours are given in the UTC+1 timezone.


def check_command_return_t_minus_one(result):
assert result.is_successful()
assert result.successful
assert (
result.stdout
== """Monday, January 27, 2020


Carregando…
Cancelar
Guardar