From be4b2e830766713608ed1b68fe8064073ece705f Mon Sep 17 00:00:00 2001 From: Dario <105294544+Dario-DC@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:36:29 +0100 Subject: [PATCH] fix(curriculum): allow any node order in python depth-first search tests (#64964) Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> --- .../68d275dd800f404d22a07564.md | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md b/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md index 75b3db2586e..b8e0a5df5d8 100644 --- a/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md +++ b/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md @@ -42,19 +42,25 @@ You should have a function named `dfs` that takes two arguments. `) }) ``` -`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)` should return `[1, 2, 3, 0]`. +`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)` should return a list with `1`, `2`, `3`, and `0`. ```js ({ test: () => runPython(` - assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1) == [1, 2, 3, 0] + result = dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1) + assert isinstance(result, list) + assert len(result) == 4 + assert set(result) == {1, 2, 3, 0} `) }) ``` -`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2, 1, 0]`. +`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)` should return a list with `1`, `2`, `3`, and `0`. ```js ({ test: () => runPython(` - assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3) == [3, 2, 1, 0] + result = dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3) + assert isinstance(result, list) + assert len(result) == 4 + assert set(result) == {3, 2, 1, 0} `) }) ``` @@ -66,19 +72,21 @@ You should have a function named `dfs` that takes two arguments. `) }) ``` -`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2]`. +`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)` should return a list with `3` and `2`. ```js ({ test: () => runPython(` - assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3) == [3, 2] + result = dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3) + assert result == [3, 2] or result == [2, 3] `) }) ``` -`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)` should return `[0, 1]`. +`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)` should return a list with `0` and `1`. ```js ({ test: () => runPython(` - assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0) == [0, 1] + result = dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0) + assert result == [0, 1] or result == [1, 0] `) }) ```