Skip to content

Commit 0340dae

Browse files
authored
Merge pull request #414 from datacamp/pyodide-code-updates
[CP-3517] chore: fix typo's, use raw strings, update varnames
2 parents c440958 + 030fd31 commit 0340dae

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ workflows:
3131
build:
3232
jobs:
3333
- build-and-test:
34+
context: org-global
3435
filters:
3536
tags:
3637
only: /^v\d+\.\d+\.\d+$/
3738
- publish:
39+
context: org-global
3840
requires:
3941
- build-and-test
4042
filters:

pythonwhat/checks/has_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def has_import(
579579

580580

581581
def has_output(state, text, pattern=True, no_output_msg=None):
582-
"""Search student output for a pattern.
582+
r"""Search student output for a pattern.
583583
584584
Among the student and solution process, the student submission and solution code as a string,
585585
the ``Ex()`` state also contains the output that a student generated with his or her submission.

pythonwhat/sct_syntax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def wrapper(*args, **kwargs):
1919
args[0] if len(args) == 1 and isinstance(args[0], (list, tuple)) else args
2020
)
2121
for arg in args:
22-
if isinstance(arg, Node) and arg.parent.name is "root":
22+
if isinstance(arg, Node) and arg.parent.name == "root":
2323
arg.parent.remove_child(arg)
2424
arg.update_child_calls()
2525
return f(*args, **kwargs)

pythonwhat/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def taskRunEval(
370370
Args:
371371
tree (ast): current focused ast, used to get code to execute
372372
process: manages shell (see local.py)
373-
shell: link to to get process namespace from execution up until now
373+
shell: link to get process namespace from execution up until now
374374
env: update value in focused code by name
375375
extra_env: variables to be replaced in focused code by name from extra_env in has_expr
376376
context: sum of set_context in sct chain

pythonwhat/test_exercise.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_exercise(
2222
"""
2323
Point of interaction with the Python backend.
2424
Args:
25-
sct (str): The solution corectness test as a string of code.
25+
sct (str): The solution correctness test as a string of code.
2626
student_code (str): The code which is entered by the student.
2727
solution_code (str): The code which is in the solution.
2828
pre_exercise_code (str): The code which is executed pre exercise.
@@ -73,7 +73,7 @@ def test_exercise(
7373
# TODO: consistent success_msg
7474
def success_msg(message):
7575
"""
76-
Set the succes message of the sct. This message will be the feedback if all tests pass.
76+
Set the success message of the sct. This message will be the feedback if all tests pass.
7777
Args:
7878
message (str): A string containing the feedback message.
7979
"""

pythonwhat/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from types import ModuleType
22
import copy
33
import os
4-
import black
5-
64

75
def format_code(text):
6+
import black
87
mode = black.FileMode()
98
try:
109
return black.format_file_contents(text, fast=True, mode=mode).rstrip()

tests/test_has_output.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,42 @@
44

55

66
@pytest.mark.parametrize(
7-
"stu, passes",
7+
"student_code, passes",
88
[
99
('print("Hi, there!")', True),
1010
('print("hi there!")', True),
1111
('print("Hello there")', False),
1212
],
1313
)
14-
def test_has_output_basic(stu, passes):
15-
s = setup_state(stu, "")
14+
def test_has_output_basic(student_code, passes):
15+
s = setup_state(student_code, "")
1616
with helper.verify_sct(passes):
1717
s.has_output(r"[H|h]i,*\s+there!")
1818

1919

2020
@pytest.mark.parametrize(
21-
"stu, passes",
21+
"student_code, passes",
2222
[
2323
('print("Hi, there!")', True),
2424
('print("hi there!")', False),
2525
('print("Hello there")', False),
2626
],
2727
)
28-
def test_has_output_pattern(stu, passes):
29-
s = setup_state(stu, "")
28+
def test_has_output_pattern(student_code, passes):
29+
s = setup_state(student_code, "")
3030
with helper.verify_sct(passes):
3131
s.has_output("Hi, there!", pattern=False)
3232

3333

3434
@pytest.mark.parametrize(
35-
"stu, passes",
35+
"student_code, passes",
3636
[
3737
('print("Hi, there!")', True),
3838
('print("hi there!")', True),
3939
('print("Hello there")', False),
4040
],
4141
)
42-
def test_test_output_contains(stu, passes):
43-
s = setup_state(stu, "")
42+
def test_test_output_contains(student_code, passes):
43+
s = setup_state(student_code, "")
4444
with helper.verify_sct(passes):
4545
s.test_output_contains(r"[H|h]i,*\s+there!")

0 commit comments

Comments
 (0)