from kqml import cl_json, KQMLList


def test_parse():
    json_dict = {'a': 1, 'b': 2,
                 'c': ['foo', {'bar': None, 'done': False}],
                 'this_is_json': True}
    res = cl_json._cl_from_json(json_dict)
    assert isinstance(res, KQMLList)
    assert len(res) == 2*len(json_dict.keys())
    back_dict = cl_json.cl_to_json(res)
    assert len(back_dict) == len(json_dict)
    # TODO: Should test for equality.

@@ -30,16 +30,667 @@
 LList%0A%0A%0A
+def _equal(json_val, back_json_val):%0A    if json_val is False and back_json_val is None:%0A        return True%0A    if type(json_val) != type(back_json_val):%0A        return False%0A%0A    if isinstance(json_val, dict):%0A        ret = True%0A        for key, value in json_val.items():%0A            if not _equal(value, back_json_val%5Bkey%5D):%0A                ret = False%0A                break%0A    elif isinstance(json_val, list):%0A        ret = True%0A        for i, value in enumerate(json_val):%0A            if not _equal(value, back_json_val%5Bi%5D):%0A                ret = False%0A                break%0A    else:%0A        ret = (json_val == back_json_val)%0A    return ret%0A%0A%0A
 def test
@@ -695,24 +695,24 @@
 st_parse():%0A
-
     json_dic
@@ -1051,38 +1051,40 @@
     
-# TODO: Should test for equality.
+assert _equal(json_dict, back_dict)
 %0A

Write deeper test of equality for recovered dict.