Skip to content

Commit 58d70f0

Browse files
committed
modified first 5 student_code tests
1 parent 1c66e4b commit 58d70f0

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

tests/student_code/executor_sanity.py

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'''
12
import time
23
import math
34
@@ -23,3 +24,26 @@ def teleop_setup():
2324
2425
def teleop_main():
2526
oops = 1 / 0
27+
'''
28+
29+
import time
30+
import math
31+
32+
# This autonomous code prints some output every two seconds
33+
34+
def constant_print(msg):
35+
while True:
36+
print(f"{msg} printing again")
37+
time.sleep(2)
38+
39+
def autonomous():
40+
print('Autonomous has begun!')
41+
print(f"Starting position: {Robot.start_pos}")
42+
while True:
43+
Robot.run(constant_print, "autonomous")
44+
45+
# This teleop code generates a DivisionByZero Python error
46+
47+
def teleop():
48+
while True:
49+
oops = 1 / 0

tests/student_code/keyboard_input.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
'''
22
simple_device = "62_20"
33
44
def autonomous_setup():
@@ -16,3 +16,18 @@ def teleop_main():
1616
elif Keyboard.get_value('y'):
1717
print(Robot.get_value(simple_device, "MY_INT"))
1818
Robot.sleep(.45)
19+
'''
20+
21+
simple_device = "62_20"
22+
23+
def autonomous():
24+
while True:
25+
pass
26+
27+
def teleop():
28+
while True:
29+
if Keyboard.get_value('a'):
30+
Robot.set_value(simple_device, "MY_INT", 123454321)
31+
elif Keyboard.get_value('y'):
32+
print(Robot.get_value(simple_device, "MY_INT"))
33+
Robot.sleep(0.45)

0 commit comments

Comments
 (0)