import unittest
import cdrt

class TestTestdata(unittest.TestCase):
   def test(self):
      from pathlib import Path
      for path in Path('./testdata').rglob('*.yaml'):
         doc = cdrt.Doc.from_file(path)
         result = doc.render()
         print(doc.to_dict())
         with open(path, "r") as f:
            d = cdrt.yaml_load(f)
            if "expect" in d:
               print(f'expect "{d["expect"]}", got "{result}"')
               self.assertEqual(d["expect"], result)

if __name__ == "__main__":
   unittest.main()
