-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72b8bf3
commit 09004e6
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,3 +147,6 @@ jupyter_ydoc/_version.py | |
!.yarn/versions | ||
docs/source/api | ||
docs/source/changelog.md | ||
# pixi environments | ||
.pixi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from jupyter_ydoc import YBlob | ||
|
||
|
||
def test_yblob(): | ||
yblob = YBlob() | ||
assert yblob.get() == b"" | ||
yblob.set(b"012") | ||
assert yblob.get() == b"012" | ||
changes = [] | ||
|
||
def callback(topic, event): | ||
print(topic, event) | ||
changes.append((topic, event)) | ||
|
||
yblob.observe(callback) | ||
yblob.set(b"345") | ||
assert len(changes) == 1 | ||
topic, event = changes[0] | ||
assert topic == "source" | ||
assert event.keys["bytes"]["oldValue"] == b"012" | ||
assert event.keys["bytes"]["newValue"] == b"345" |