Exemplo n.º 1
0
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")
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def do_X(self, arg):
     """Go Along : X 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.go_along(self, command)
Exemplo n.º 9
0
 def do_circle(self,arg):
     """Draw Circle"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_circle(self,command)
Exemplo n.º 10
0
 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)
Exemplo n.º 11
0
 def do_W(self, arg):
     """Draw line 270 degrees : W 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_line(self, 270, command)
Exemplo n.º 12
0
 def do_S(self, arg):
     """Draw line 120 degrees : S 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_line(self, 180, command)
Exemplo n.º 13
0
 def do_E(self, arg):
     """Draw line 90 degrees : E 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_line(self, 90, command)
Exemplo n.º 14
0
 def do_N(self, arg):
     """Draw line 0 degrees : N 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_line(self, 0, command)
Exemplo n.º 15
0
 def do_Y(self, arg):
     """Go Down : Y 100"""
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.go_down(self, command)
Exemplo n.º 16
0
 def do_circle(self, arg):
     """Draw Circle"""
     self.results.writeToFile("Drawing a circle")
     command = IntegerParser.parse(self, arg)
     TurtleDrawer.draw_circle(self, command)
Exemplo n.º 17
0
 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)
Exemplo n.º 18
0
 def do_P(self, arg):
     """Select Pen:  P 10"""
     data = IntegerParser.parse(self, arg)
     TurtleDrawer.select_pen(self, data)