class TestArgumentParser(unittest.TestCase):
    def setUp(self):
        self.tkinterParser = ArgumentParser(TurtleDrawer())
        self.source = [
            '-c', '-e', '-t', '-k', '-g', '1', '2', '3', '4', '5', '6', '7',
            '8', '9', '0'
        ]

    def test_parse(self):
        raised = False
        try:
            self.tkinterParser.parse(self.source)
        except:
            raised = True
        self.assertFalse(raised, "Error Raised")
Beispiel #2
0
 def go(self):
     result = ArgumentParser.parse(self, '')
     if result == 'g':
         print('graphics')
         self.results.writeToFile("Graphics")
     elif result == 't':
         self.results.writeToFile("Running Turtle Command")
         TurtlePrompt().cmdloop()
     elif result == 'k':
         self.results.writeToFile("Running TKInter Drawer")
         tkinter_int = TkinterGraphicInterface()
         tkinter_int.setup()
         tkinter_int.root.mainloop()
     elif result == 'e':
         self.results.writeToFile("Exiting program")
         exit()
     else:
         self.results.writeToFile("Graphics from else "
                                  "+as arguments were wrong")
         print('graphics')
Beispiel #3
0
 def go(self):
     result = ArgumentParser.parse(self, '')
     if result == 'g':
         print('graphics')
         self.results.writeToFile("Graphics")
     elif result == 't':
         self.results.writeToFile("Running Turtle Command")
         TurtlePrompt().cmdloop()
     elif result == 'k':
         self.results.writeToFile("Running TKInter Drawer")
         tkinter_builder = TkinterGraphicalBuilder()
         tkinter_int = TkinterDirector(tkinter_builder)
         tkinter_int.construct_user_interface()
     elif result == 'e':
         self.results.writeToFile("Exiting program")
         exit()
     else:
         self.results.writeToFile("Graphics from else "
                                  "+as arguments were wrong")
         print('graphics')
Beispiel #4
0

class ArgumentSourceReader(AbstractSourceReader):
    results = Writer("SourceReader_Result.txt")

    def go(self):
        result = ArgumentParser.parse(self, '')
        if result == 'g':
            print('graphics')
            self.results.writeToFile("Graphics")
        elif result == 't':
            self.results.writeToFile("Running Turtle Command")
            TurtlePrompt().cmdloop()
        elif result == 'k':
            self.results.writeToFile("Running TKInter Drawer")
            tkinter_int = TkinterGraphicInterface()
            tkinter_int.setup()
            tkinter_int.root.mainloop()
        elif result == 'e':
            self.results.writeToFile("Exiting program")
            exit()
        else:
            self.results.writeToFile("Graphics from else "
                                     "+as arguments were wrong")
            print('graphics')


if __name__ == '__main__':
    s = ArgumentSourceReader(ArgumentParser(''))
    s.go()
 def setUp(self):
     self.Reader = ArgumentSourceReader(ArgumentParser(TurtleDrawer()))
     self.source = ['-e', '-t', '-k', '-g']
 def setUp(self):
     self.tkinterParser = ArgumentParser(TurtleDrawer())
     self.source = [
         '-c', '-e', '-t', '-k', '-g', '1', '2', '3', '4', '5', '6', '7',
         '8', '9', '0'
     ]