Skip to content

Commit

Permalink
Fix for "none" units edge case (#583)
Browse files Browse the repository at this point in the history
Tiny bugfix for unit conversion edge case that was trying to convert
"None" to "none"

## Description
Convert "none" units to lowercase before comparing.

User interface changes?: No

Fixes: 
closes #567

Testing:
- Updated var_compatability_test to include a "None" to "none"
comparison

Co-authored-by: Courtney Peverley <[email protected]>
  • Loading branch information
peverwhee and Courtney Peverley authored Aug 7, 2024
1 parent 5f338dd commit 58308e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions scripts/var_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,13 @@ def __init__(self, var1_stdname, var1_type, var1_kind, var1_units,
# end if
# end if
if self.__compat:
# Only "none" units are case-insensitive
if var1_units.lower() == 'none':
var1_units = 'none'
# end if
if var2_units.lower() == 'none':
var2_units = 'none'
# end if
# Check units argument
if var1_units != var2_units:
self.__equiv = False
Expand Down
2 changes: 1 addition & 1 deletion test/var_compatibility_test/test_host.meta
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[ errmsg ]
standard_name = ccpp_error_message
long_name = Error message for error handling in CCPP
units = none
units = None
dimensions = ()
type = character
kind = len=512
Expand Down

0 comments on commit 58308e4

Please sign in to comment.