xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
180 stars 28 forks source link

added error handling for JSON duplicate IDs #538

Closed nwlandry closed 4 months ago

nwlandry commented 5 months ago

If we construct a hypergraph as

>>> import xgi
>>> H = xgi.Hypergraph()
>>> H.add_nodes_from(["2", 2])
>>> xgi.write_json(H, "test.json")

>>> H2 = xgi.read_json("test.json")
>>> H2.nodes
NodeView(("2"))

These will get mapped to a single node when we cast IDs to strings for the JSON. This will raise an error instead.

review-notebook-app[bot] commented 5 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.35%. Comparing base (9140f10) to head (d7ff176).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #538 +/- ## ========================================== + Coverage 92.29% 92.35% +0.05% ========================================== Files 60 60 Lines 4493 4500 +7 ========================================== + Hits 4147 4156 +9 + Misses 346 344 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nwlandry commented 4 months ago

Thanks so much, @thomasrobiglio!!