def test_dict_is_ok(self): obj = OrderedMap(Base).parse(Node([ Node({Node("a"): Node("b")}), Node({Node("c"): Node("d")}), ])) data = [(k, v.data) for k, v in obj.data.items()] assert data == [("a", "b"), ("c", "d")]
def test_non_list_data_is_invalid(self, data): with pytest.raises(ParseError, match="list"): OrderedMap(Base).parse(Node(data))
def test_empty_list_is_ok(self): assert OrderedMap(Base).parse(Node([])).data == {}