コード例 #1
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_wrong_folder(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int)))
     self.socket = pop_engine.Socket('another_test', exampleproject_path,
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.PluginError):
         self.socket.plug("example2")
コード例 #2
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_wrong_version_format(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int)))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.PluginError):
         self.socket.plug("example_wrong_ver_for")
コード例 #3
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_withoutpy(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('a', None)))
     socket = pop_engine.Socket('example_project', exampleproject_path,
                                "0.0.0", 'example2')
     self.assertEqual(socket.functions, funcs)
コード例 #4
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_wrong_folder(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('a', None)))
     with self.assertRaises(pop_engine.VersionError):
         socket = pop_engine.Socket('another_test', exampleproject_path,
                                    "1.0.0", 'example2.py')
コード例 #5
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_no_file(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('a', None)))
     with self.assertRaises(FileNotFoundError):
         socket = pop_engine.Socket('example_project', exampleproject_path,
                                    "0.0.0", 'not_here')
コード例 #6
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_wrong_interface(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, str)))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.FunctionInterfaceError):
         self.socket.plug("example2")
コード例 #7
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_function_doesnt_exist(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('does_not_exist', None)))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.LackOfFunctionsError):
         self.socket.plug("example2")
コード例 #8
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_create_plugin_already_exists(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('a', None)))
     socket = pop_engine.Socket('example_project', exampleproject_path,
                                "0.0.0", 'example2.py')
     with self.assertRaises(FileExistsError):
         socket.generate_template('example2.py')
コード例 #9
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_partial_compatibility(self):
     funcs = dict((
         pop_engine.gen_functionDS('add', int, int, int),
         pop_engine.gen_functionDS('sub', int, int, int),
     ))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     self.socket.plug("example_compatible")
     self.assertEqual(self.socket.get_plugin_name(), 'example_compatible')
コード例 #10
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_import_folder(self):
     funcs = dict((
         pop_engine.gen_functionDS('add', int, int, int),
         pop_engine.gen_functionDS('sub', int, int, int),
     ))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     self.socket.plug("test_folder")
     self.assertEqual(self.socket.get_plugin_name(), 'test_folder')
コード例 #11
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_changed_names(self):
     funcs = dict((
         pop_engine.gen_functionDS('ger', int, int, int),
         pop_engine.gen_functionDS('fe', int, int, int),
     ))
     self.socket = pop_engine.Socket('example_project', "<> test <>",
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.LackOfFunctionsError):
         self.socket.fits(example1)
コード例 #12
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_plugin_doesnt_exist(self):
     funcs = dict((
         pop_engine.gen_functionDS('add', int, int, int),
         pop_engine.gen_functionDS('sub', int, int, int),
     ))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     with self.assertRaises(FileNotFoundError):
         self.socket.plug("does_not_exist")
コード例 #13
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_good_import(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('random', int),
                   pop_engine.gen_functionDS('str_int_none', None, str,
                                             int)))
     self.socket = pop_engine.Socket('example_project', "<> test <>",
                                     "0.0.0", funcs)
     self.assertTrue(self.socket.fits(example1))
コード例 #14
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def setUp(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('sub_wrongin', int, int, int),
                   pop_engine.gen_functionDS('sub_wrongout', int, int, int),
                   pop_engine.gen_functionDS('random', int),
                   pop_engine.gen_functionDS('str_int_none', None, str,
                                             int)))
     self.socket = pop_engine.Socket('example_project', "<> test <>",
                                     "0.0.0", funcs)
コード例 #15
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_create_plugin(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('a', None)))
     socket = pop_engine.Socket('example_project', exampleproject_path,
                                "0.0.0", 'example2.py')
     socket.generate_template('test_plugin')
     tested = os.path.isfile(f"{exampleproject_path}/test_plugin.py")
     os.remove(f"{exampleproject_path}/test_plugin.py")
     self.assertTrue(tested)
コード例 #16
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_plugin_change(self):
     funcs = dict((
         pop_engine.gen_functionDS('add', int, int, int),
         pop_engine.gen_functionDS('sub', int, int, int),
     ))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     self.socket.plug("example2")
     self.socket.plug("example2_")
     self.assertEqual(self.socket.get_plugin_name(), "example2_")
コード例 #17
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_find_plugin(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int)))
     self.socket = pop_engine.Socket('example_project', exampleproject_path,
                                     "0.0.0", funcs)
     tested = self.socket.find_plugins()
     self.assertSetEqual(
         set(tested), {
             'example2', 'example2_', 'example_compatible',
             'example_wrong_ver_for', 'test_folder', 'example_utils'
         })
コード例 #18
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_wrong_return(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('sub_wrongout', int, int, int),
                   pop_engine.gen_functionDS('random', int),
                   pop_engine.gen_functionDS('str_int_none', None, str,
                                             int)))
     self.socket = pop_engine.Socket('example_project', "<> test <>",
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.FunctionInterfaceError):
         self.socket.fits(example1)
コード例 #19
0
ファイル: poptest.py プロジェクト: Larch-Team/Larch
 def test_lack_function(self):
     funcs = dict((pop_engine.gen_functionDS('add', int, int, int),
                   pop_engine.gen_functionDS('sub', int, int, int),
                   pop_engine.gen_functionDS('addstring', str, str, str),
                   pop_engine.gen_functionDS('sub_wrongout', int, int, int),
                   pop_engine.gen_functionDS('random', int),
                   pop_engine.gen_functionDS('str_int_none', None, str,
                                             int)))
     self.socket = pop_engine.Socket('example_project', "<> test <>",
                                     "0.0.0", funcs)
     with self.assertRaises(pop_engine.LackOfFunctionsError):
         self.socket.fits(example1)
コード例 #20
0
ファイル: __main__.py プロジェクト: Larch-Team/Larch
            print(
                'Larch wymaga co najmniej Pythona 3.9 do działania. Zainstaluj go ze strony https://www.python.org/downloads/'
            )
            input()
            sys.exit()

        manager = FileManager(DEBUG, VERSION)
        manager.download_required(FORCE_DOWNLOAD)

        # Log clearing
        if os.path.exists('log.log'):
            os.remove('log.log')

        # UserInterface socket generation
        UI = pop.Socket('UserInterface',
                        os.path.abspath('plugins/UserInterface'), '0.0.1',
                        '__template__')

        # App run
        try:
            configs = os.listdir(os.path.abspath('config'))
        except FileNotFoundError:
            os.mkdir('config')
            configs = []
        if not configs:
            UI.plug('CLI')
        else:
            p = 'config/config.json' if 'config.json' in configs else configs[0]
            with open(p, 'r') as file:
                config = json.load(file)
            UI.plug(config['chosen_plugins']['UserInterface'])