Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views should be read-only #371

Merged
merged 7 commits into from
May 21, 2023
Merged

Views should be read-only #371

merged 7 commits into from
May 21, 2023

Conversation

nwlandry
Copy link
Collaborator

I found a bug where H.edges.members() creates a list with entries that are references to H._edge and so modifying H.edges.members() modifies the internal data structure. Same with H.nodes.memberships(). Also modified a few of the docstrings.

@codecov
Copy link

codecov bot commented May 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.16 🎉

Comparison is base (9318be2) 90.58% compared to head (57576ba) 90.74%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #371      +/-   ##
==========================================
+ Coverage   90.58%   90.74%   +0.16%     
==========================================
  Files          41       42       +1     
  Lines        3060     3113      +53     
==========================================
+ Hits         2772     2825      +53     
  Misses        288      288              
Impacted Files Coverage Δ
xgi/classes/hypergraph.py 85.37% <100.00%> (ø)
xgi/classes/reportviews.py 93.58% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@maximelucas
Copy link
Collaborator

Nice! Could you add a quick test for that?

@nwlandry
Copy link
Collaborator Author

Nice! Could you add a quick test for that?

Good point! Just did.

@nwlandry nwlandry merged commit 4bc2ea7 into main May 21, 2023
@nwlandry nwlandry deleted the small-fixes branch May 21, 2023 17:17
Comment on lines +170 to +180
# test that members are copies in memory
H.edges.members(0).add("a")
assert "a" not in H.edges.members(0)

e = H.edges.members()
e[0].add("a")
assert "a" not in H.edges.members(0)

e = H.edges.members(dtype=dict)
e[0].add("a")
assert "a" not in H.edges.members(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather this be a separate test :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants