-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[easy] Test for Codebook.to_json / open_json (#1645)
This verifies that the two operations are symmetric. Test plan: this is the test.
- Loading branch information
Tony Tung
authored
Nov 13, 2019
1 parent
9e03fc7
commit 3072f3c
Showing
2 changed files
with
17 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
|
||
from .factories import simple_codebook_array | ||
from ..codebook import Codebook | ||
|
||
|
||
def test_to_json(tmp_path): | ||
code_array = simple_codebook_array() | ||
codebook = Codebook.from_code_array(code_array) | ||
codebook_path = tmp_path / "codebook.json" | ||
codebook.to_json(codebook_path) | ||
|
||
loaded_codebook = Codebook.open_json(os.fspath(codebook_path)) | ||
assert codebook.equals(loaded_codebook) |