Skip to content

Commit

Permalink
fix(dataclasses): include milliseconds in scalar types
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brewer committed Jul 2, 2021
1 parent cc128ad commit b08802e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def aws_time(timezone_offset: int = 0) -> str:
str
Returns current time as AWSTime scalar string with optional timezone offset
"""
return _formatted_time(datetime.datetime.utcnow(), "%H:%M:%S", timezone_offset)
return _formatted_time(datetime.datetime.utcnow(), "%H:%M:%S.%f", timezone_offset)


def aws_datetime(timezone_offset: int = 0) -> str:
Expand All @@ -81,7 +81,7 @@ def aws_datetime(timezone_offset: int = 0) -> str:
str
Returns current time as AWSDateTime scalar string with optional timezone offset
"""
return _formatted_time(datetime.datetime.utcnow(), "%Y-%m-%dT%H:%M:%S", timezone_offset)
return _formatted_time(datetime.datetime.utcnow(), "%Y-%m-%dT%H:%M:%S.%f", timezone_offset)


def aws_timestamp() -> int:
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,13 +1210,13 @@ def test_aws_date_utc():
def test_aws_time_utc():
time_str = aws_time()
assert isinstance(time_str, str)
assert datetime.datetime.strptime(time_str, "%H:%M:%SZ")
assert datetime.datetime.strptime(time_str, "%H:%M:%S.%fZ")


def test_aws_datetime_utc():
datetime_str = aws_datetime()
assert isinstance(datetime_str, str)
assert datetime.datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%SZ")
assert datetime.datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%S.%fZ")


def test_aws_timestamp():
Expand Down

0 comments on commit b08802e

Please sign in to comment.