rm CondaPkg environment

This commit is contained in:
ton
2023-04-06 13:53:47 +07:00
parent 0a57ed7884
commit c43d949309
3329 changed files with 5725 additions and 447022 deletions

View File

@@ -72,9 +72,17 @@ class TestConvertNumpyArray:
nodelist += [nodelist[0]]
pytest.raises(nx.NetworkXError, nx.to_numpy_array, P3, nodelist=nodelist)
# Make nodelist invalid by including non-existent nodes
nodelist = [-1, 0, 1]
with pytest.raises(
nx.NetworkXError,
match=f"Nodes {nodelist - P3.nodes} in nodelist is not in G",
):
nx.to_numpy_array(P3, nodelist=nodelist)
def test_weight_keyword(self):
WP4 = nx.Graph()
WP4.add_edges_from((n, n + 1, dict(weight=0.5, other=0.3)) for n in range(3))
WP4.add_edges_from((n, n + 1, {"weight": 0.5, "other": 0.3}) for n in range(3))
P4 = path_graph(4)
A = nx.to_numpy_array(P4)
np.testing.assert_equal(A, nx.to_numpy_array(WP4, weight=None))
@@ -105,6 +113,12 @@ class TestConvertNumpyArray:
A = np.array([[1]]).astype(object)
pytest.raises(TypeError, nx.from_numpy_array, A)
A = np.array([[[1, 1, 1], [1, 1, 1]], [[1, 1, 1], [1, 1, 1]]])
with pytest.raises(
nx.NetworkXError, match=f"Input array must be 2D, not {A.ndim}"
):
g = nx.from_numpy_array(A)
def test_from_numpy_array_dtype(self):
dt = [("weight", float), ("cost", int)]
A = np.array([[(1.0, 2)]], dtype=dt)

View File

@@ -168,7 +168,6 @@ class TestConvertPandas:
assert edges_equal(G.edges(), GW.edges())
def test_to_edgelist_default_source_or_target_col_exists(self):
G = nx.path_graph(10)
G.add_weighted_edges_from((u, v, u) for u, v in list(G.edges))
nx.set_edge_attributes(G, 0, name="source")
@@ -182,7 +181,6 @@ class TestConvertPandas:
pytest.raises(nx.NetworkXError, nx.to_pandas_edgelist, G)
def test_to_edgelist_custom_source_or_target_col_exists(self):
G = nx.path_graph(10)
G.add_weighted_edges_from((u, v, u) for u, v in list(G.edges))
nx.set_edge_attributes(G, 0, name="source_col_name")

View File

@@ -108,7 +108,7 @@ class TestConvertScipy:
def test_weight_keyword(self):
WP4 = nx.Graph()
WP4.add_edges_from((n, n + 1, dict(weight=0.5, other=0.3)) for n in range(3))
WP4.add_edges_from((n, n + 1, {"weight": 0.5, "other": 0.3}) for n in range(3))
P4 = path_graph(4)
A = nx.to_scipy_sparse_array(P4)
np.testing.assert_equal(
@@ -123,7 +123,7 @@ class TestConvertScipy:
def test_format_keyword(self):
WP4 = nx.Graph()
WP4.add_edges_from((n, n + 1, dict(weight=0.5, other=0.3)) for n in range(3))
WP4.add_edges_from((n, n + 1, {"weight": 0.5, "other": 0.3}) for n in range(3))
P4 = path_graph(4)
A = nx.to_scipy_sparse_array(P4, format="csr")
np.testing.assert_equal(
@@ -164,7 +164,7 @@ class TestConvertScipy:
with pytest.raises(nx.NetworkXError):
WP4 = nx.Graph()
WP4.add_edges_from(
(n, n + 1, dict(weight=0.5, other=0.3)) for n in range(3)
(n, n + 1, {"weight": 0.5, "other": 0.3}) for n in range(3)
)
P4 = path_graph(4)
nx.to_scipy_sparse_array(P4, format="any_other")