Skip to content

Timestamps without precision does not serialize/deserialize correctly #208

@jackhxs-alt

Description

@jackhxs-alt

Description

  • Ubuntu 20.04
  • Python 3.9.9
  • amazon.ion version 0.9.2

Actual:
Serializing then deserializing an instance of IonPyTimestamp without a precision field returns a different timestamp than the original.

Expected:
It should return a timestamp equal to the original.

Repro

On python interpreter:

Python 3.9.9 (main, Nov 23 2021, 15:07:55) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from amazon.ion import simpleion, simple_types
>>> a = simple_types.IonPyTimestamp.fromisoformat('2022-07-19T15:10:15.412119+00:00')
>>> a
Timestamp(2022-07-19T15:10:15.412119, datetime.timezone.utc, None, fractional_precision=6)
>>> b = simpleion.loads(simpleion.dumps(a))
>>> b
Timestamp(2022-01-01T00:00:00.000000, None, <TimestampPrecision.YEAR: 0>, fractional_precision=0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions