Skip to content

Commit f84d00b

Browse files
committed
Pull request #244: Bugfix/test remove not inplace intermittent issue
Merge in HYP/hypernetx from bugfix/test-remove-not-inplace-intermittent-issue to develop * commit '6ccd4783c1a5a5351898f3fb00d19ec8bb999f66': bump: version 2.4.2 → 2.4.3 Adding pandas constraint This test is occasionally failing when checking the id of the new hypergraph against the original. This is potentially due to the original getting garbage collected and the new new hypergraph being assigned to the original. The test was rewritten to prevent garbage collecting the original hg in the test. bump: version 2.4.1 → 2.4.2
2 parents 129de47 + 6ccd478 commit f84d00b

5 files changed

Lines changed: 11 additions & 12 deletions

File tree

.cz.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.commitizen]
22
name = "cz_conventional_commits"
3-
version = "2.4.1"
3+
version = "2.4.3"
44
version_provider = "poetry"
55
version_files = [
66
"pyproject.toml",

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import os
2020

2121

22-
__version__ = "2.4.1"
22+
__version__ = "2.4.3"
2323

2424

2525
# If extensions (or modules to document with autodoc) are in another directory,

hypernetx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
from .utils import *
1212
from .utils.toys import *
1313

14-
__version__ = "2.4.1"
14+
__version__ = "2.4.3"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hypernetx"
3-
version = "2.4.1"
3+
version = "2.4.3"
44
description = "HyperNetX is a Python library for the creation and study of hypergraphs."
55
authors = ["Brenda Praggastis <Brenda.Praggastis@pnnl.gov>", "Dustin Arendt <dustin.arendt@pnnl.gov>",
66
"Sinan Aksoy <sinan.aksoy@pnnl.gov>", "Emilie Purvine <Emilie.Purvine@pnnl.gov>",
@@ -24,7 +24,7 @@ packages = [
2424
[tool.poetry.dependencies]
2525
python = ">=3.10,<4.0.0"
2626
networkx = ">=3.3"
27-
pandas = ">=2.2.2"
27+
pandas = "<3.0.0"
2828
scikit-learn = ">=1.4.2"
2929
igraph = ">=0.11.4"
3030
decorator = ">=5.1.1"

tests/classes/test_hypergraph.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -978,45 +978,44 @@ def test_remove_edges_nodes_incidences_inplace(triloop2):
978978
def test_remove_edges_nodes_incidences_not_inplace(triloop2):
979979
# triloop2 is a hypergraph of the following shape:
980980
# {AB: {A, B}, BC: {B, C}, ACD: {A, C, D, E}, ACD2: {A, C, D, E}}
981-
hg = Hypergraph(triloop2.edgedict, name=triloop2.name)
981+
original_hg = hg = Hypergraph(triloop2.edgedict, name=triloop2.name)
982982
assert hg.shape == (5, 4)
983-
original_hg_id = id(hg)
984983
original_hg_name = hg.name
985984
new_name = f"{triloop2.name}_new"
986985

987986
# removing a duplicate edge should not affect the number of nodes
988987
duplicate_edge = ["ACD2"]
989988
hg = hg.remove_edges(duplicate_edge, name=new_name, inplace=False)
990989
assert hg.shape == (5, 3)
991-
assert id(hg) != original_hg_id
990+
assert id(hg) != id(original_hg)
992991
assert hg.name != original_hg_name
993992
assert hg.name == new_name
994993

995994
# number of nodes should drop by 1
996995
hg = hg.remove_nodes(["E"], name=new_name, inplace=False)
997996
assert hg.shape == (4, 3)
998-
assert id(hg) != original_hg_id
997+
assert id(hg) != id(original_hg)
999998
assert hg.name != original_hg_name
1000999
assert hg.name == new_name
10011000

10021001
# number of edges should drop by 1
10031002
hg = hg.remove_edges(["ACD"], name=new_name, inplace=False)
10041003
assert hg.shape == (3, 2)
1005-
assert id(hg) != original_hg_id
1004+
assert id(hg) != id(original_hg)
10061005
assert hg.name != original_hg_name
10071006
assert hg.name == new_name
10081007

10091008
# remove an incidence that no longer exists; no change
10101009
hg = hg.remove_incidences([("ACD", "E")], name=new_name, inplace=False)
10111010
assert hg.shape == (3, 2)
1012-
assert id(hg) != original_hg_id
1011+
assert id(hg) != id(original_hg)
10131012
assert hg.name != original_hg_name
10141013
assert hg.name == new_name
10151014

10161015
# removing the last two remaining edges will remove all the nodes from the hypergraph
10171016
hg = hg.remove_edges(["AB", "BC"], name=new_name, inplace=False)
10181017
assert hg.shape == (0, 0)
1019-
assert id(hg) != original_hg_id
1018+
assert id(hg) != id(original_hg)
10201019
assert hg.name != original_hg_name
10211020
assert hg.name == new_name
10221021

0 commit comments

Comments
 (0)