From 6d2c5d10fa44d7670b2a1be3a8a345132433de0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 9 Apr 2026 11:11:53 +0200 Subject: [PATCH 1/2] test: Add snapshot test for attributes --- tests/testthat/_snaps/attributes.md | 16 ++++++++++++++++ tests/testthat/test-attributes.R | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/testthat/_snaps/attributes.md b/tests/testthat/_snaps/attributes.md index 172c445888a..98ec946572c 100644 --- a/tests/testthat/_snaps/attributes.md +++ b/tests/testthat/_snaps/attributes.md @@ -1,3 +1,19 @@ +# with_vertex_ + + Code + make_(from_literal(A - A:B:C, B - A:B:C), with_vertex_(color = 1:2)) + Condition + Error in `.apply_modifiers()`: + ! Length of new attribute value must be 1 or 3, the number of target vertices, not 2. + +# with_edge_ + + Code + make_(from_literal(A - A:B:C, B - A:B:C), with_edge_(color = 1:2)) + Condition + Error in `.apply_modifiers()`: + ! Length of new attribute value must be 1 or 3, the number of target edges, not 2. + # error messages work Code diff --git a/tests/testthat/test-attributes.R b/tests/testthat/test-attributes.R index bf54e2ae311..3d614cc2455 100644 --- a/tests/testthat/test-attributes.R +++ b/tests/testthat/test-attributes.R @@ -379,6 +379,11 @@ test_that("with_vertex_", { expect_identical_graphs(g1, g2) expect_equal(V(g2)$color, rep("red", gorder(g2))) expect_equal(V(g2)$foo, paste0("xx", 1:3)) + + expect_snapshot( + make_(from_literal(A - A:B:C, B - A:B:C), with_vertex_(color = 1:2)), + error = TRUE + ) }) @@ -398,6 +403,11 @@ test_that("with_edge_", { expect_identical_graphs(g1, g2) expect_equal(E(g1)$color, E(g2)$color) expect_equal(E(g1)$foo, E(g2)$foo) + + expect_snapshot( + make_(from_literal(A - A:B:C, B - A:B:C), with_edge_(color = 1:2)), + error = TRUE + ) }) From 9918c48fdf5917ef560cc4151a3050efd589282f Mon Sep 17 00:00:00 2001 From: krlmlr Date: Thu, 9 Apr 2026 09:19:52 +0000 Subject: [PATCH 2/2] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/24182267776 --- tests/testthat/_snaps/attributes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/attributes.md b/tests/testthat/_snaps/attributes.md index 98ec946572c..aaf268a1752 100644 --- a/tests/testthat/_snaps/attributes.md +++ b/tests/testthat/_snaps/attributes.md @@ -3,7 +3,7 @@ Code make_(from_literal(A - A:B:C, B - A:B:C), with_vertex_(color = 1:2)) Condition - Error in `.apply_modifiers()`: + Error in `i_set_vertex_attr()`: ! Length of new attribute value must be 1 or 3, the number of target vertices, not 2. # with_edge_ @@ -11,7 +11,7 @@ Code make_(from_literal(A - A:B:C, B - A:B:C), with_edge_(color = 1:2)) Condition - Error in `.apply_modifiers()`: + Error in `i_set_edge_attr()`: ! Length of new attribute value must be 1 or 3, the number of target edges, not 2. # error messages work