We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1228690 commit 95d1a91Copy full SHA for 95d1a91
python/tests/test_y_sweet.py
@@ -86,6 +86,21 @@ def test_get_update_direct(self):
86
text2 = doc2.get("text", type=Y.Text)
87
self.assertEqual(text2.to_py(), "Hello, world!")
88
89
+ def test_update_context(self):
90
+ dm = DocumentManager(CONNECTION_STRING)
91
+ name = f"{self.random_string}-test-doc"
92
+ dm.create_doc(name)
93
+ conn = dm.get_connection(name)
94
+
95
+ with conn.for_update() as doc:
96
+ text = doc.get("text", type=Y.Text)
97
+ text.insert(0, "Hello, world!")
98
99
+ update = dm.get_doc_as_update(name)
100
+ doc2 = Y.Doc()
101
+ doc2.apply_update(update)
102
+ text2 = doc2.get("text", type=Y.Text)
103
+ self.assertEqual(text2.to_py(), "Hello, world!")
104
105
if __name__ == "__main__":
106
unittest.main()
0 commit comments