microbit = codesters.Microbit()
microbit.show_string("hello")
stage.set_background("soccerfield")
sprite = codesters.Sprite("athlete2")
sprite.move_down(150)
def button_a():
sprite.move_left(50)
microbit.event_button_a(button_a)
def button_b():
sprite.move_right(50)
microbit.event_button_b(button_b)
t = codesters.Teacher()
try:
sprites = t.find_function("Sprite")
tval1 = sprites[1][1]
except:
tval1 = "DNE"
try:
tval2 = ball
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success("soccerball" in tval1, "Great job!")
t1.add_failure("soccerball" not in tval1, "Did you add the soccer ball sprite?")
t1.add_failure(tval1 == "DNE", "Did you add in the soccer ball sprite?")
t2 = TestObjective()
t2.add_success(tval2 != "DNE", "Great job!")
t2.add_failure(tval2 == "DNE", "Did you change the name from sprite to ball?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()