Skip to content

Commit

Permalink
Tests for unicode characters in nested JSON, refs #257
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 19, 2021
1 parent 6f4f9a3 commit a95954c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def test_create_index_if_not_exists(fresh_db):
{"dictionary": {"nested": "complex"}},
collections.OrderedDict(
[
("key1", {"nested": "complex"}),
("key1", {"nested": ["cømplex"]}),
("key2", "foo"),
]
),
Expand All @@ -762,6 +762,14 @@ def test_insert_dictionaries_and_lists_as_json(fresh_db, data_structure):
assert data_structure == json.loads(row[1])


def test_insert_list_nested_unicode(fresh_db):
fresh_db["test"].insert(
{"id": 1, "data": {"key1": {"nested": ["cømplex"]}}}, pk="id"
)
row = fresh_db.execute("select id, data from test").fetchone()
assert row[1] == '{"key1": {"nested": ["cømplex"]}}'


def test_insert_uuid(fresh_db):
uuid4 = uuid.uuid4()
fresh_db["test"].insert({"uuid": uuid4})
Expand Down

0 comments on commit a95954c

Please sign in to comment.