-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from Peefy/refactor-jsonpatch-module-tests
refactor: jsonpatch module test and bump version to 0.0.3
- Loading branch information
Showing
4 changed files
with
32 additions
and
32 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
kcl -D __test__ | ||
kcl test |
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,5 +1,5 @@ | ||
[package] | ||
name = "jsonpatch" | ||
version = "0.0.2" | ||
version = "0.0.3" | ||
description = "`jsonpatch` is a module for applying JSON patches (RFC 6902) for KCL values." | ||
|
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,27 @@ | ||
test_json_patch = lambda { | ||
data = { | ||
"firstName": "John", | ||
"lastName": "Doe", | ||
"age": 30, | ||
"address": { | ||
"streetAddress": "1234 Main St", | ||
"city": "New York", | ||
"state": "NY", | ||
"postalCode": "10001" | ||
}, | ||
"phoneNumbers": [ | ||
{ | ||
"type": "home", | ||
"number": "212-555-1234" | ||
}, | ||
{ | ||
"type": "work", | ||
"number": "646-555-5678" | ||
} | ||
] | ||
} | ||
phoneNumbers0type: str = get_obj(data, "phoneNumbers/0/type") | ||
newObj = set_obj(data, "phoneNumbers/0/type", "school") | ||
assert phoneNumbers0type == "home" | ||
assert newObj["phoneNumbers"][0]["type"] == "school" | ||
} |