class TestIntegerParser(unittest.TestCase): def setUp(self): self.tkinterIntParser = IntegerParser(TurtleDrawer()) self.source = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] def test_parse(self): raised = False try: self.tkinterIntParser.parse(self.source) except: raised = True self.assertTrue(raised, "Error Raised")
def do_square(self, arg): """Draw Square""" self.results.writeToFile("Drawing a square") command = IntegerParser.parse(self, arg) directions = [0, 90, 180, 270] for i in directions: TurtleDrawer.draw_line(self, i, command)
def do_W(self, arg): """Draw line 270 degrees : W 100""" self.results.writeToFile("Draw line 270 degrees : W", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 270, command)
def do_S(self, arg): """Draw line 120 degrees : S 100""" self.results.writeToFile("Draw line 120 degrees : S", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 180, command)
def do_E(self, arg): """Draw line 90 degrees : E 100""" self.results.writeToFile("Draw line 90 degrees : E", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 90, command)
def do_Y(self, arg): """Go Down : Y 100""" self.results.writeToFile("Go Along : Y", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.go_down(self, command)
def do_X(self, arg): """Go Along : X 100""" self.results.writeToFile("Go Along : X ", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.go_along(self, command)
def do_X(self, arg): """Go Along : X 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.go_along(self, command)
def do_circle(self,arg): """Draw Circle""" command = IntegerParser.parse(self, arg) TurtleDrawer.draw_circle(self,command)
def do_square(self, arg): """Draw Square""" command = IntegerParser.parse(self, arg) directions = [0, 90, 180, 270] for i in directions: TurtleDrawer.draw_line(self, i, command)
def do_W(self, arg): """Draw line 270 degrees : W 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 270, command)
def do_S(self, arg): """Draw line 120 degrees : S 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 180, command)
def do_E(self, arg): """Draw line 90 degrees : E 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 90, command)
def do_N(self, arg): """Draw line 0 degrees : N 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 0, command)
def do_Y(self, arg): """Go Down : Y 100""" command = IntegerParser.parse(self, arg) TurtleDrawer.go_down(self, command)
def do_circle(self, arg): """Draw Circle""" self.results.writeToFile("Drawing a circle") command = IntegerParser.parse(self, arg) TurtleDrawer.draw_circle(self, command)
def do_P(self, arg): """Select Pen: P 10""" self.results.writeToFile("Selected pen", arg) data = IntegerParser.parse(self, arg) TurtleDrawer.select_pen(self, data)
def do_P(self, arg): """Select Pen: P 10""" data = IntegerParser.parse(self, arg) TurtleDrawer.select_pen(self, data)