Extend test coverage for jax_utils.py#2023
Closed
irhyl wants to merge 1 commit intogoogle-deepmind:mainfrom
Closed
Extend test coverage for jax_utils.py#2023irhyl wants to merge 1 commit intogoogle-deepmind:mainfrom
irhyl wants to merge 1 commit intogoogle-deepmind:mainfrom
Conversation
Add 17 new tests covering previously untested functions: - get_np_dtype: default/f64/f32 dtype selection, invalid dtype error - env_bool: true/false/1/0 strings, case insensitivity, missing env var default, invalid value raises - assert_rank: correct rank, wrong rank error, scalar rank - error_if: passthrough behavior when errors disabled Also add cache_clear() in setUp to ensure test isolation for cached dtype functions.
Collaborator
|
Thanks for the contribution. I think only the tests on the np dtype are worth adding here. The rest of the tests are checking logic on error_if and assert rank that I don't think adds much value unfortunately. Please feel free to reopen a smaller PR with only the np tests but otherwise I'm going to close this for now. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Doubles the test coverage for
jax_utils.pyfrom 15 to 32 tests by adding coverage forget_np_dtype,env_bool,assert_rank, anderror_if.Changes
torax/_src/tests/jax_utils_test.pyget_np_dtype(default, f64, f32, invalid dtype)env_bool(true/false/1/0 strings, case insensitivity, missing env var, invalid)assert_rank(correct, wrong, scalar)error_if(passthrough behavior)get_np_dtype.cache_clear()insetUpfor test isolationTesting
All 32 tests pass (15 pre-existing + 17 new).