From d444cc0cb73f8ea6c14279bd132c2aadf3a15110 Mon Sep 17 00:00:00 2001 From: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:33:23 +0100 Subject: [PATCH] fix(curriculum): add opposite parameter validation tests (#66296) --- .../67d83df6f82eda3868dd2a84.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md b/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md index 21424fdb36b..50c9e90b510 100644 --- a/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md +++ b/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md @@ -68,6 +68,16 @@ for wrong_type in wrong_types: }) ``` +When `create_character` is called with a first argument that is a string it should not return `The character name should be a string`. + +```js +({ + test: () => runPython( + `assert create_character('ren', 1, 2, 4) != 'The character name should be a string'` + ) +}) +``` + When `create_character` is called with a first argument that is an empty string, it should return `The character should have a name`. ```js @@ -80,6 +90,18 @@ assert create_character('', 4, 2, 1) == 'The character should have a name' }) ``` +When `create_character` is called with a first argument that is not an empty string, it should not return `The character should have a name`. + +```js +({ + test: () => runPython( + ` +assert create_character('ren', 4, 2, 1) != 'The character should have a name' +` + ) +}) +``` + When `create_character` is called with a first argument that is longer than 10 characters it should return `The character name is too long`. ```js @@ -118,6 +140,18 @@ assert create_character('cha cha', 4, 1, 2) == 'The character name should not co }) ``` +When `create_character` is called with a first argument that does not contain a space it should not return `The character name should not contain spaces`. + +```js +({ + test: () => runPython( + ` +assert create_character('chacha', 4, 2, 1) != 'The character name should not contain spaces' +` + ) +}) +``` + When `create_character` is called with a second, third or fourth argument that is not an integer it should return `All stats should be integers`. ```js @@ -134,6 +168,18 @@ for wrong_type in wrong_types: }) ``` +When `create_character` is called with a second, third and fourth argument that are all integers it should not return `All stats should be integers`. + +```js +({ + test: () => runPython( + ` +assert create_character('friend', 4, 2, 1) != 'All stats should be integers' +` + ) +}) +``` + When `create_character` is called with a second, third or fourth argument that is lower than `1` it should return `All stats should be no less than 1`. ```js @@ -153,6 +199,18 @@ assert create_character('ren', 4, 4, -1) == expected }) ``` +When `create_character` is called with a second, third and fourth argument that are all no less than `1` it should not return `All stats should be no less than 1`. + +```js +({ + test: () => runPython( + ` +assert create_character('ren', 4, 2, 1) != 'All stats should be no less than 1' +` + ) +}) +``` + When `create_character` is called with a second, third or fourth argument that is higher than `4` it should return `All stats should be no more than 4`. ```js @@ -167,6 +225,18 @@ assert create_character('ren', 1, 1, 5) == 'All stats should be no more than 4' }) ``` +When `create_character` is called with a second, third and fourth argument that are all no more than `4` it should not return `All stats should be no more than 4`. + +```js +({ + test: () => runPython( + ` +assert create_character('ren', 4, 2, 1) != 'All stats should be no more than 4' +` + ) +}) +``` + When `create_character` is called with a second, third or fourth argument that do not sum to `7` it should return `The character should start with 7 points`. ```js @@ -181,6 +251,18 @@ assert create_character('ren', 1, 2, 3) == 'The character should start with 7 po }) ``` +When `create_character` is called with a second, third and fourth argument that sum to `7` it should not return `The character should start with 7 points`. + +```js +({ + test: () => runPython( + ` +assert create_character('ren', 4, 2, 1) != 'The character should start with 7 points' +` + ) +}) +``` + `create_character('ren', 4, 2, 1)` should return `ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○`. ```js