-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for collections.UserString, accept any in Encoder, Decoder
- Loading branch information
1 parent
7948f92
commit 5191bab
Showing
7 changed files
with
87 additions
and
6 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
.pytest_cache | ||
__pycache__ | ||
.DS_Store | ||
/dist |
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,32 @@ | ||
from collections import UserString | ||
|
||
from chili import decode, encode | ||
|
||
|
||
def test_can_encode_userstring() -> None: | ||
# given | ||
class ComplexString(UserString): | ||
pass | ||
|
||
string = ComplexString("Example String") | ||
|
||
# when | ||
result = encode(string) | ||
|
||
# then | ||
assert result == "Example String" | ||
|
||
|
||
def test_can_decode_userstring() -> None: | ||
# given | ||
class ComplexString(UserString): | ||
pass | ||
string = "Example String" | ||
|
||
# when | ||
result = decode(string, ComplexString) | ||
|
||
# then | ||
assert result == ComplexString("Example String") | ||
assert isinstance(result, ComplexString) | ||
assert isinstance(result, UserString) |