Add base dumping/serialization mechanism.

This commit is contained in:
Sergio Martínez Portela 2020-06-22 00:40:47 +02:00
parent d29058cb5e
commit d23ee1adba
4 changed files with 177 additions and 41 deletions

View file

@ -1,10 +1,9 @@
import logging
import os
import sys
import unittest
from datetime import datetime as DT
from org_dom import load, loads
from org_dom import dumps, load, loads
from utils.dom_assertions import HL, Dom
DIR = os.path.dirname(os.path.abspath(__file__))
@ -37,3 +36,11 @@ class TestSerde(unittest.TestCase):
])))
ex.assert_matches(self, doc)
def test_mimic_write_file_01(self):
"""A goal of this library is to be able to update a file without changing parts not directly modified."""
with open(os.path.join(DIR, '01-simple.org')) as f:
orig = f.read()
doc = loads(orig)
self.assertEqual(dumps(doc), orig)