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')
#!/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())
from src.Application import Application import sys app = Application() app.main(sys.argv)
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
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")
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')
def main(): """ Main function. """ result = Application.run(sys.argv) sys.exit(result)
from src.Application import Application Application().run()
import pygame from src.Application import Application if __name__ == "__main__": pygame.init() pygame.font.init() app = Application() app.run() pygame.quit()
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()
from src.Application import Application app = Application() app.boostrap()
from src.Application import Application if __name__ == '__main__': application = Application() application.run()
def runServer(): server = tornado.httpserver.HTTPServer(Application()) server.listen(8080) print("Server listen on 8080") IOLoop.instance().start()