Skip to content

Commit 82e0c8b

Browse files
authored
Merge pull request #175 from ToFuProject/Issue174_RobustUnitsCheck
`'units'` are equal whether `str` or `asunits.Unit` when looking for conflicts
2 parents 07a2521 + 340083b commit 82e0c8b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

datastock/_class1_check.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,14 @@ def _check_conflicts(dd=None, dd0=None, dd_name=None, returnas=None):
147147
or (
148148
not isinstance(v0[kk], np.ndarray)
149149
and not scpsp.issparse(v0[kk])
150-
and v0[kk] == dd0[k0][kk]
150+
and (
151+
v0[kk] == dd0[k0][kk]
152+
or (
153+
# asunit.Unit vs str should be the same
154+
kk == 'units'
155+
and str(v0[kk]) == str(dd0[k0][kk])
156+
)
157+
)
151158
)
152159
)
153160
)
@@ -1925,4 +1932,4 @@ def _select(dd=None, dd_name=None, log=None, returnas=None, **kwdargs):
19251932
[k0 for jj, k0 in enumerate(dd.keys()) if ind[jj]],
19261933
dtype=str,
19271934
)
1928-
return ind
1935+
return ind

0 commit comments

Comments
 (0)