VForWaTer / metacatalog

Modular metadata management platform for environmental data.
https://vforwater.github.io/metacatalog
GNU General Public License v3.0
4 stars 1 forks source link

Fix rs.to_dict(orient='uuids') in the case that rs.group is None #298

Closed AlexDo1 closed 1 year ago

AlexDo1 commented 1 year ago

I just stumbled upon an error in #296.

Old code produced an error, as rs.group just returns None when no group is associated to the ImmutableResultSet:

return {member.uuid: member.to_dict() for member in [rs.group, *rs._members]}

New code checks if member has attribute to_dict before adding it to returned dictionary:

return {member.uuid: member.to_dict() for member in [rs.group, *rs._members] if hasattr(member, 'to_dict')}
codecov[bot] commented 1 year ago

Codecov Report

Merging #298 (23db118) into main (4c57796) will increase coverage by 0.01%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #298      +/-   ##
==========================================
+ Coverage   64.48%   64.50%   +0.01%     
==========================================
  Files          75       75              
  Lines        3934     3922      -12     
==========================================
- Hits         2537     2530       -7     
+ Misses       1397     1392       -5     
Flag Coverage Δ
e2e 64.50% <0.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
metacatalog/util/results.py 74.58% <0.00%> (ø)

... and 1 file with indirect coverage changes