Dmitry Kirsanov commited on
Commit
500b077
·
1 Parent(s): 8a89a6f

jsonpickle saving works

Browse files
Files changed (1) hide show
  1. fad.py +8 -1
fad.py CHANGED
@@ -417,6 +417,13 @@ if __name__ == "__main__":
417
  for id, note in f.notes.items():
418
  assert(note.needs_updating_from() == []) # in normal operation, there should be no contratemporal refs X -> something newer than X (it means X needs updating)
419
 
420
- print(jsonpickle.encode(f, indent=4))
 
 
 
 
 
 
 
421
 
422
 
 
417
  for id, note in f.notes.items():
418
  assert(note.needs_updating_from() == []) # in normal operation, there should be no contratemporal refs X -> something newer than X (it means X needs updating)
419
 
420
+ json =jsonpickle.encode(f, indent=4, keys=True)
421
+ with open("fad.json", "w") as fo:
422
+ fo.write(json)
423
+
424
+ with open("fad.json", "r") as fin:
425
+ fn = jsonpickle.decode(fin.read(), keys=True)
426
+ assert(fn.get_plaintext_with_markup("point", show_id=False, show_properties=True, properties_to_show=['concepts']) == '<point/>A<point/><point concepts="important concept 2"/>123456789B123456789C123456789')
427
+
428
 
429