Skip to content

Commit

Permalink
Make Python operations stricter about types (#1708)
Browse files Browse the repository at this point in the history
* Make Python operations stricter about types

* format

* fix test

* format

* Address review

* fix tests

* format
  • Loading branch information
Fidget-Spinner authored Jun 3, 2024
1 parent 24c0aa3 commit 05287c5
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/stdlib/__tests__/__snapshots__/pylib.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Object {
"code": "True * 2",
"displayResult": Array [],
"numErrors": 1,
"parsedErrors": "Line 1: Error: Expected number on left hand side of operation, got boolean.",
"parsedErrors": "Line 1: Error: Invalid types for multiply operation: boolean, bigint",
"result": undefined,
"resultStatus": "error",
"visualiseListResult": Array [],
Expand Down
4 changes: 1 addition & 3 deletions src/stdlib/__tests__/pylib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ test('cannot multiply non-number values', () => {
True * 2
`,
{ chapter: Chapter.PYTHON_1, native: true }
).toMatchInlineSnapshot(
`"Line 1: Error: Expected number on left hand side of operation, got boolean."`
)
).toMatchInlineSnapshot(`"Line 1: Error: Invalid types for multiply operation: boolean, bigint"`)
})

test('dividing integer and float is ok', () => {
Expand Down
Loading

0 comments on commit 05287c5

Please sign in to comment.