Closed EpicWink closed 4 years ago
Addressed and fixed this - check #35. I was assuming since we had a test suite some sanity tests for all types were covered so I went a bit off-guard while writing this code. Seems I was wrong, pretty bad bugs crept in indeed :sweat_smile:
Currently passthrough tests for all three date/time types work:
import pytomlpp
t = pytomlpp.loads('bestdateever = 1987-07-05')
print(t)
t = pytomlpp.dumps(t)
print(t)
t = pytomlpp.loads('besttimeever = 17:45:00')
print(t)
t = pytomlpp.dumps(t)
print(t)
t = pytomlpp.loads('bestdatetimeever = 1987-07-05T17:45:00Z')
print(t)
t = pytomlpp.dumps(t)
print(t)
{'bestdateever': datetime.date(1987, 7, 5)}
bestdateever = 1987-07-05
{'besttimeever': datetime.time(17, 45)}
besttimeever = 17:45:00
{'bestdatetimeever': datetime.datetime(1987, 7, 5, 17, 45, tzinfo=datetime.timezone.utc)}
bestdatetimeever = 1987-07-05T17:45:00Z
Yeah my bad, I failed to add dump tests
Dumping seems to giving an incorrect value for date-time objects. I added some round-trip tests to show this.
See the failed workflow, with the
datetime
test outputting: