Example #1
0
def test_dot_list_keys_sorted() -> None:
    d = JsonObj(d1)
    expected = [
        "id",
        "code",
        "subd.a",
        "subd.b.herm",
        "type",
        "bars",
        "n",
        "date_str",
        "float_here",
        "complex",
        "profile_id",
        "state",
    ]
    print(d.dot_keys_list(sort_keys=True))
    assert [tuple(el.split('.'))
            for el in sorted(expected)] == d.dot_keys_list(sort_keys=True)
Example #2
0
def test_dot_list_keys() -> None:
    d = JsonObj(d1)
    expected = [
        "id",
        "code",
        "subd.a",
        "subd.b.herm",
        "type",
        "bars",
        "n",
        "date_str",
        "float_here",
        "complex",
        "profile_id",
        "state",
    ]
    assert set([tuple(el.split('.'))
                for el in expected]) == set(d.dot_keys_list())