-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
整理: NumPy 向けスナップショットユーティリティを追加 (#1356)
* refactor: `round_float()` ユーティリティに NumPy 対応を追加 * refactor: `hash_big_ndarray()` ユーティリティを追加 * refactor: TTS 出力スナップショットをハッシュ化 * fix: テスト名の重複を修正 * refactror: ユーティリティのテストを分割 * refactor: テスト用ユーティリティのテストを移動 * refactor: `summarize_big_ndarray()` を追加 * refactor: `round_floats()` 内の判定順序を変更 * fix: ndarray の float 判定を追加 * refactor: docstring を明確化 Co-authored-by: Hiroshiba <[email protected]> * fix: `summarize_big_ndarray()` 出力型を変更 Co-authored-by: Hiroshiba <[email protected]> * fix: `summarize_big_ndarray()` 出力型の変更を反映 * fix: lint --------- Co-authored-by: Hiroshiba <[email protected]>
- Loading branch information
Showing
5 changed files
with
72 additions
and
12,808 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""テストユーティリティ `summarize_big_ndarray()` のテスト""" | ||
|
||
from test.utility import summarize_big_ndarray | ||
|
||
import numpy as np | ||
|
||
|
||
def test_summarize_big_ndarray_raw_small_array() -> None: | ||
"""`summarize_big_ndarray()` は小さい NumPy 配列を要約しない。""" | ||
# Inputs | ||
target = np.array([111.111]) | ||
# Tests | ||
assert summarize_big_ndarray(target) == np.array([111.111]) | ||
|
||
|
||
def test_summarize_big_ndarray_raw_big_array() -> None: | ||
"""`summarize_big_ndarray()` は大きい NumPy 配列を要約する。""" | ||
# Inputs | ||
target = np.ones([10, 10, 10]) | ||
# Expects | ||
true_hash_header = "MD5:" | ||
true_shape = target.shape | ||
# Outputs | ||
summary = summarize_big_ndarray(target) | ||
hash_header = summary["hash"][:4] | ||
shape = tuple(summary["shape"]) | ||
# Tests | ||
assert true_hash_header == hash_header | ||
assert true_shape == shape |
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.