Skip to content
Open
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 src-python/amazon/ion/equivalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _timestamps_eq(a, b):
if isinstance(b, Timestamp):
# Both operands declare their precisions. They are only equivalent if their precisions are the same.
if a.precision is b.precision and a.fractional_precision is b.fractional_precision \
and a.fractional_seconds == b.fractional_seconds:
and _decimals_eq(a.fractional_seconds, b.fractional_seconds):
break
return False
elif a.precision is not TimestampPrecision.SECOND or a.fractional_precision != MICROSECOND_PRECISION:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_equivalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def _ion_nature(_ion_nature_cls, ion_type, value=None, annotations=()):
_ts(1999, 12, 31, 23, 59, off_hours=0, off_minutes=-1, precision=_TP.SECOND),
None,
),
(
# Timestamps with different fractional precisions beyond microseconds are not equivalent.
_timestamp(_ts(2000, precision=_TP.SECOND, fractional_seconds=Decimal('0.000000'))),
_timestamp(_ts(2000, precision=_TP.SECOND, fractional_seconds=Decimal('0.0000000'))),
),
(
# Timestamps with different fractional seconds are not equivalent.
_timestamp(_ts(2000, 1, 1, 1, precision=_TP.SECOND, fractional_seconds=Decimal('0.123456789'))),
Expand Down