from SimpleSprite import SimpleSprite def tester(): try: cat = SimpleSprite("Scratchy") except: print("If you are reading this it suggests that your") print("Simple Sprite class has compiler issues") return try: if not (cat.getX()==0 and cat.getY()==0 and \ cat.getDirection()==90 and cat.getSize()==100 and\ cat.isVisible): print("Your constructor (the __init__ function) does not set to the defaults requested.") return except: print("Check spelling of your five accessor functions:") print(" getX()") print(" getY()") print(" getDirection()") print(" getSize()") print(" isVisible()") return try: for x in range(10): cat.move(10) if not cat.getX()==100: print("move() not working as expected when moving right.") return for x in range(9): cat.turnClockwise(10) if not cat.getDirection()==180: print("turnClockwise() or getDirection() not working as expected.") return for x in range(10): cat.move(10) if not cat.getY()==-100: print("move() not working as expected when moving down.") return for x in range(18): cat.turnCounterClockwise(10) if not cat.getDirection()==0: print("turnCounterClockwise() not working as expected [FIRST time].") return for x in range(10): cat.move(10) if not cat.getY()==0: print("move() not working as expected when moving up.") return for x in range(9): cat.turnCounterClockwise(10) if not cat.getDirection()==-90: print("turnCounterClockwise() not working as expected [SECOND time].") return for x in range(10): cat.move(10) if not cat.getX()==0: print("move() not working as expected when moving left.") return except: print("Check spelling of your basic movement functions:") print(" move()") print(" turnClockwise()") print(" turnCounterClockwise()") return try: cat.gotoXY(100,100) if not (cat.getX()==100 and cat.getY()==100): print("gotoXY() not working as expected.") return cat.changeX(10) if not (cat.getX()==110 and cat.getY()==100): print("changeX() not working as expected.") return cat.setX(10) if not (cat.getX()==10 and cat.getY()==100): print("setX() not working as expected.") return cat.changeY(40) if not (cat.getX()==10 and cat.getY()==140): print("changeY() not working as expected.") return cat.setY(50) if not (cat.getX()==10 and cat.getY()==50): print("setY() not working as expected.") return except: print("Check the spelling of your X/Y modifiers") print(" changeX()") print(" setX()") print(" changeY()") print(" setY()") print(" gotoXY()") return try: cat.pointInDirection(45) if not cat.getDirection()==45: print("pointInDirection() not working as expected.") cat.hide() if cat.isVisible(): print("hide() or isVisible() not working as expected.") return cat.show() if not cat.isVisible(): print("show() or isVisible() not working as expected.") return cat.changeSize(-30) if not cat.getSize()==70: print("changeSize() or getSize() not working as expected.") return cat.setSize(50) if not cat.getSize()==50: print("setSize not working as expected.") return except: print("Check the spelling of") print(" pointInDirection()") print(" hide()") print(" show()") print(" changeSize()") print(" setSize()") return print("If you see this I think you got it right!") tester()