Exemplo n.º 1
0
    def test_inits(self):
    
        input_file = 'some input file'
        wordlist_file = 'some wordlist file'
        mock_file = Mock(read=Mock(return_value=['some word']))
        mock_similarity_checker=Mock(process_sentance=Mock(return_value={'sentance' : 'test sentance' , 'distance' : 100}))
        print_function = Mock()

        Application(input_file , wordlist_file , file=mock_file , similarity_checker=mock_similarity_checker , print_function=print_function)
        
        mock_file.read.assert_called__with('some input file')
        mock_file.read.assert_called__with('some wordlist file')
        mock_similarity_checker.process_sentance.assert_called_with(['some word'] , 'some word')
        print_function.assert_called_with('Total number of changes that had to be made: 100')
Exemplo n.º 2
0
#!/usr/bin/env python3

from src.Application import Application
from PyQt5.QtWidgets import *
import sys
import os


def excepthook(type, value, tb):
    import traceback
    traceback.print_tb(tb)
    print(repr(value))
    response = QMessageBox.warning(Application.mainWindow, "Error",
                                   repr(value),
                                   QMessageBox.Ok | QMessageBox.Close)
    if response != QMessageBox.Ok:
        sys.exit(1)


sys.excepthook = excepthook

if __name__ == "__main__":
    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    app = Application(sys.argv)
    sys.exit(app.exec())
Exemplo n.º 3
0
from src.Application import Application
import sys

app = Application()
app.main(sys.argv)
Exemplo n.º 4
0
 def create_application(self, student, school, time):
     key = (student.name, school.name)
     assert key not in self.applications, key
     application = Application(student, school, time)
     self.applications[key] = application
     return application
Exemplo n.º 5
0
from dotenv import load_dotenv
load_dotenv()

from os import getenv
from wsgiref.simple_server import make_server
from src.Application import Application

if __name__ == "__main__":
  port = int(getenv("PORT"))
  host = getenv("HOST")
  app = Application()

  print(f"* * * STARTING AT {host}:{port}")

  try:
    srv = make_server(host, port, app)
    srv.serve_forever()
    """
    The servers keeps listening to any HTTP Request on the `host`:`port` specified
    """
  except:
    print("* * * FINISHING SERVER")
Exemplo n.º 6
0
import sys
from src.Application import Application

if __name__ == '__main__':
    if len(sys.argv) > 1:
        try:
            Application(sys.argv[1], '/var/tmp/wordlist.txt')
        except UnboundLocalError:
            print('One or more of the files can not be read.')
    else:
        print('Please input a filename')
Exemplo n.º 7
0
def main():
    """
    Main function.
    """
    result = Application.run(sys.argv)
    sys.exit(result)
Exemplo n.º 8
0
from src.Application import Application

Application().run()
Exemplo n.º 9
0
import pygame
from src.Application import Application

if __name__ == "__main__":
    pygame.init()
    pygame.font.init()

    app = Application()
    app.run()

    pygame.quit()
Exemplo n.º 10
0
 def __init__(self):
     enviroment = Enviroment()
     application = Application(enviroment)
     self.app = application.init()
     self.client = self.app.test_client()
     self.db = self.app.di.database().get_db()
Exemplo n.º 11
0
from src.Application import Application

app = Application()
app.boostrap()
Exemplo n.º 12
0
from src.Application import Application

if __name__ == '__main__':
    application = Application()
    application.run()
Exemplo n.º 13
0
def runServer():
    server = tornado.httpserver.HTTPServer(Application())
    server.listen(8080)
    print("Server listen on 8080")
    IOLoop.instance().start()