예제 #1
0
class TestArgumentParser(unittest.TestCase):
    def setUp(self):
        self.tkinterParser = ArgumentParser(TurtleDrawer())
        self.source = ['-c', '-e', '-t', '-k', '-g']

    def test_parse(self):
        raised = False
        try:
            self.tkinterParser.parse(self.source)
        except:
            raised = True
        self.assertFalse(raised, "Error Raised")
예제 #2
0
    def go(self):
        result = ArgumentParser.parse(self, '')

        if result == 'g':
            print('graphics')
        elif result == 't':
            TurtlePrompt().cmdloop()
        elif result == 'k':
            TkinterDrawer().start()
        elif result == 'e':
            exit()
        else:
            print('graphics')
 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")
         TKinterDrawerPackage().start()
     elif result == 'e':
         self.results.writeToFile("Exiting program")
         exit()
     else:
         self.results.writeToFile(("Graphics from else as "
                                   "arguments were wrong"))
         print('graphics')
from tkinterdrawer import TKinterDrawerPackage
from writer import *


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")
            TKinterDrawerPackage().start()
        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()
예제 #5
0
 def setUp(self):
     self.Reader = ArgumentSourceReader(ArgumentParser(TurtleDrawer()))
     self.source = ['-e', '-t', '-k', '-g']
예제 #6
0
 def setUp(self):
     self.tkinterParser = ArgumentParser(TurtleDrawer())
     self.source = [
         '-c', '-e', '-t', '-k', '-g', '1', '2', '3', '4', '5', '6', '7',
         '8', '9', '0'
     ]
예제 #7
0
 def setUp(self):
     self.tkinterParser = ArgumentParser(TurtleDrawer())
     self.source = ['-c', '-e', '-t', '-k', '-g']
예제 #8
0
 def setUp(self):
     self.tkinterParser = ArgumentParser(TurtleDrawer())