fix(curriculum): add opposite parameter validation tests (#66296)

This commit is contained in:
majestic-owl448
2026-03-10 16:33:23 +01:00
committed by GitHub
parent 66c9c7913f
commit d444cc0cb7
@@ -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