-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into griffin/fix-link-double-click
- Loading branch information
Showing
36 changed files
with
762 additions
and
165 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
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
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
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
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
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
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,22 @@ | ||
from tempfile import NamedTemporaryFile | ||
|
||
from weave.initialization import pil_image_thread_safety | ||
|
||
|
||
def test_patching_import_order(): | ||
# This test verifies the correct behavior if patching occurs after the construction | ||
# of an image | ||
assert pil_image_thread_safety._patched | ||
pil_image_thread_safety.undo_threadsafe_patch_to_pil_image() | ||
assert not pil_image_thread_safety._patched | ||
import PIL | ||
|
||
image = PIL.Image.new("RGB", (10, 10)) | ||
with NamedTemporaryFile(suffix=".png") as f: | ||
image.save(f.name) | ||
image = PIL.Image.open(f.name) | ||
|
||
pil_image_thread_safety.apply_threadsafe_patch_to_pil_image() | ||
assert pil_image_thread_safety._patched | ||
|
||
image.crop((0, 0, 10, 10)) |
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,45 @@ | ||
import weave | ||
|
||
|
||
def test_dictifiable(client): | ||
class NonDictifiable: | ||
attr: int | ||
|
||
def __init__(self, attr: int): | ||
self.attr = attr | ||
|
||
class Dictifiable: | ||
attr: int | ||
|
||
def __init__(self, attr: int): | ||
self.attr = attr | ||
|
||
def to_dict(self): | ||
return {"attr": self.attr} | ||
|
||
@weave.op | ||
def func(d: Dictifiable, nd: NonDictifiable) -> dict: | ||
return { | ||
"d": Dictifiable(d.attr), | ||
"nd": NonDictifiable(nd.attr), | ||
} | ||
|
||
val = 42 | ||
d = Dictifiable(val) | ||
nd = NonDictifiable(val) | ||
res = func(d, nd) | ||
assert isinstance(res["d"], Dictifiable) | ||
assert res["d"].attr == val | ||
assert isinstance(res["nd"], NonDictifiable) | ||
assert res["nd"].attr == val | ||
|
||
call = func.calls()[0] | ||
|
||
assert call.inputs["d"] == {"attr": val} | ||
assert call.inputs["nd"].startswith( | ||
"<test_dictifiable.test_dictifiable.<locals>.NonDictifiable object at" | ||
) | ||
assert call.output["d"] == {"attr": val} | ||
assert call.output["nd"].startswith( | ||
"<test_dictifiable.test_dictifiable.<locals>.NonDictifiable object at" | ||
) |
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
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
2 changes: 1 addition & 1 deletion
2
weave-js/src/components/PagePanelComponents/Home/Browse3/grid/pagination.ts
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
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
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
Oops, something went wrong.