Skip to content

Commit

Permalink
restore newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Nov 7, 2024
1 parent 22e77a3 commit ef4a9fa
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,39 @@ def test_attribute_modification():
assert graph.node_attrs[4].attr2 == 80

graph.node_attrs[[2, 3, 4]].attr3 += np.array(
[[1, 1, 1], [2, 2, 2], [3, 3, 3]], dtype="float32"
[
[1, 1, 1],
[2, 2, 2],
[3, 3, 3],
],
dtype="float32",
)
np.testing.assert_array_almost_equal(graph.node_attrs[2].attr3, [1.3, 1.6, 1.9])
np.testing.assert_array_almost_equal(graph.node_attrs[3].attr3, [2.3, 2.6, 2.9])
np.testing.assert_array_almost_equal(graph.node_attrs[4].attr3, [3.3, 3.6, 3.9])

# modify edge attribute
np.testing.assert_array_equal(
graph.edge_attrs[[[1, 2], [5, 1]]].attr1, [[1, 2, 3, 4], [3, 4, 5, 6]]
graph.edge_attrs[[[1, 2], [5, 1]]].attr1,
[
[1, 2, 3, 4],
[3, 4, 5, 6],
],
)
graph.edge_attrs[[[1, 2], [5, 1]]].attr1 = np.array(
[[11, 22, 33, 44], [30, 40, 50, 60]], dtype="int"
[
[11, 22, 33, 44],
[30, 40, 50, 60],
],
dtype="int",
)
np.testing.assert_array_equal(
graph.edge_attrs[[[1, 2], [3, 4], [5, 1]]].attr1,
[[11, 22, 33, 44], [2, 3, 4, 5], [30, 40, 50, 60]],
[
[11, 22, 33, 44],
[2, 3, 4, 5],
[30, 40, 50, 60],
],
)


Expand Down

0 comments on commit ef4a9fa

Please sign in to comment.