Improve Timestamp and TimeRange handling.

This commit is contained in:
Sergio Martínez Portela 2020-12-10 00:12:13 +01:00
parent 7f67c768c6
commit b2779dbc41
3 changed files with 37 additions and 4 deletions

16
tests/05-dates.org Normal file
View file

@ -0,0 +1,16 @@
#+TITLE: 05-Dates
#+DESCRIPTION: Simple org file
#+TODO: TODO(t) PAUSED(p) | DONE(d)
* Headline properties
:PROPERTIES:
:JUST_DAY: [2020-12-10]
:DAY_AND_WEEKDAY: [2020-12-10 Xov]
:DAY_AND_HOUR: [2020-12-10 Xov 00:02]
:JUST_DAY_TIME_RANGE: [2020-12-10]--[2020-12-11]
:JUST_DAY_TIME_RANGE_NEGATIVE: [2020-12-11]--[2020-12-10]
:DAY_AND_WEEKDAY_TIME_RANGE: [2020-12-10 Xov]--[2020-12-11 Ven]
:DAY_AND_WEEKDAY_TIME_RANGE_NEGATIVE: [2020-12-11 Ven]--[2020-12-10 Xov]
:DAY_AND_HOUR_TIME_RANGE: [2020-12-10 00:02]--[2020-12-11 00:30]
:DAY_AND_HOUR_TIME_RANGE_NEGATIVE: [2020-12-10 00:30]--[2020-12-11 00:02]
:END:

View file

@ -278,3 +278,10 @@ class TestSerde(unittest.TestCase):
self.assertEqual(
snippets[1].result, "This is another test\n" + "with two lines too"
)
def test_mimic_write_file_05(self):
with open(os.path.join(DIR, "05-dates.org")) as f:
orig = f.read()
doc = loads(orig)
self.assertEqual(dumps(doc), orig)