Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion moto/glue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def __init__(self) -> None:
).set_name("cond")

# conditions can be joined using 2-ary AND and/or OR
expr = infix_notation(
expr = infix_notation( # type: ignore[no-untyped-call]
cond,
[
(and_, 2, OpAssoc.LEFT, _BoolAnd),
Expand Down
4 changes: 2 additions & 2 deletions moto/sagemaker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def filter_model_cards(
filtered_versions = versions

if creation_time_after:
if isinstance(creation_time_after, int):
if isinstance(creation_time_after, (int, float)):
creation_time_after = datetime.fromtimestamp(
creation_time_after, tz=timezone.utc
)
Expand All @@ -103,7 +103,7 @@ def filter_model_cards(
]

if creation_time_before:
if isinstance(creation_time_before, int):
if isinstance(creation_time_before, (int, float)):
creation_time_before = datetime.fromtimestamp(
creation_time_before, tz=timezone.utc
)
Expand Down
10 changes: 3 additions & 7 deletions tests/test_scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
from moto.core.utils import utcnow


def pytest_parametrize_test_create_get_schedule__with_start_date() -> list[
tuple[datetime, datetime]
]:
def pytest_parametrize_test_create_get_schedule__with_start_date() -> list[datetime]:
now = utcnow()
timedelta_kwargs = {"days": 1, "hours": 1, "weeks": 1}
return_ = []
for k, v in timedelta_kwargs.items():
to_append = now + timedelta(**{k: v})
return_.append((to_append, to_append.replace(microsecond=0)))
return_.append(now + timedelta(**{k: v}))
else:
to_append = now.replace(year=now.year + 1)
return_.append((to_append, to_append.replace(microsecond=0)))
return_.append(now.replace(year=now.year + 1))
return return_


Expand Down
8 changes: 5 additions & 3 deletions tests/test_scheduler/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ def test_delete_schedule_for_none_existing_schedule():

@mock_aws
@pytest.mark.parametrize(
"start_date,expected_start_date",
"start_date",
pytest_parametrize_test_create_get_schedule__with_start_date(),
)
def test_create_get_schedule__with_start_date(start_date, expected_start_date):
def test_create_get_schedule__with_start_date(start_date):
# Act
client = boto3.client("scheduler", region_name="eu-west-1")
client.create_schedule(
Expand All @@ -263,7 +263,9 @@ def test_create_get_schedule__with_start_date(start_date, expected_start_date):
start_date_as_utc = datetime.astimezone(resp["StartDate"], timezone.utc).replace(
tzinfo=None
)
assert start_date_as_utc == expected_start_date
# Older versions of botocore truncate sub-second precision when sending
# unix timestamps, newer versions send the microseconds as-is
assert start_date_as_utc in [start_date, start_date.replace(microsecond=0)]


@mock_aws
Expand Down
Loading