-
Notifications
You must be signed in to change notification settings - Fork 16
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
730ade8
commit ca1147c
Showing
12 changed files
with
127 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ test/core.* | |
.eggs/ | ||
.idea/ | ||
.vs/ | ||
.coverage |
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,2 @@ | ||
rm -rf build dist *.egg-info | ||
FROZENDICT_PURE_PY=1 ./setup.py $* |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[tool.cibuildwheel] | ||
skip=["cp311-*", "cp312-*", "pp*"] | ||
|
||
[tool.coverage.run] | ||
omit = ["_frozendict_py.py"] |
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,2 @@ | ||
[tool.cibuildwheel] | ||
skip=["cp311-*", "cp312-*", "pp*"] |
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,42 @@ | ||
import json | ||
|
||
import frozendict as cool | ||
import pytest | ||
from frozendict import frozendict | ||
|
||
|
||
class A: | ||
pass | ||
|
||
|
||
@pytest.fixture | ||
def object_to_serialize(): | ||
return frozendict() | ||
|
||
|
||
@pytest.fixture | ||
def object_to_serialize_2(): | ||
return A() | ||
|
||
|
||
@pytest.fixture | ||
def serialized_object(): | ||
return "{}" | ||
|
||
|
||
def test_get_json_encoder( | ||
object_to_serialize, | ||
object_to_serialize_2, | ||
serialized_object, | ||
): | ||
cool.monkeypatch.patchOrUnpatchJson(patch=True, warn=False) | ||
assert json.dumps(object_to_serialize) == serialized_object | ||
|
||
with pytest.raises(TypeError): | ||
json.dumps(object_to_serialize_2) | ||
|
||
cool.monkeypatch.patchOrUnpatchJson(patch=False, warn=False) | ||
|
||
if cool.c_ext: | ||
with pytest.raises(TypeError): | ||
json.dumps(object_to_serialize) |