@@ -1072,6 +1072,33 @@ def test_collection_add(client, cleanup, database):
10721072 assert set (collection3 .list_documents ()) == {document_ref5 }
10731073
10741074
1075+ @pytest .mark .parametrize ("database" , [None , FIRESTORE_OTHER_DB ], indirect = True )
1076+ def test_unicode_doc (client , cleanup , database ):
1077+ collection_id = "coll-unicode" + UNIQUE_RESOURCE_ID
1078+ collection = client .collection (collection_id )
1079+ explicit_doc_id = "中餐" + UNIQUE_RESOURCE_ID
1080+
1081+ assert set (collection .list_documents ()) == set ()
1082+
1083+ data = {"baz" : 0 }
1084+ update_time , document_ref = collection .add (data , document_id = explicit_doc_id )
1085+ cleanup (document_ref .delete )
1086+ assert set (collection .list_documents ()) == {document_ref , document_ref }
1087+ snapshot = document_ref .get ()
1088+ assert snapshot .to_dict () == data
1089+ assert snapshot .create_time == update_time
1090+ assert snapshot .update_time == update_time
1091+ assert document_ref .id == explicit_doc_id
1092+ assert snapshot .reference .id == explicit_doc_id
1093+
1094+ # update doc
1095+ data2 = {"baz" : 9 }
1096+ snapshot .reference .update (data2 )
1097+ snapshot2 = document_ref .get ()
1098+ assert snapshot2 .to_dict () == data2
1099+ assert snapshot2 .reference .id == explicit_doc_id
1100+
1101+
10751102@pytest .fixture
10761103def query_docs (client , database ):
10771104 collection_id = "qs" + UNIQUE_RESOURCE_ID
0 commit comments