def print_scripts(workspace: str) -> None: """Print list of scripts to standard output.""" rian.set('mode', 'silent') if rian.open(workspace): ui.info('Scripts in workspace %s:\n' % (rian.get('workspace'))) for script in rian.list('scripts'): ui.info(' %s' % (script)) ui.info('')
def test_session_get(self) -> None: with self.subTest(cmd="rian.get('base')"): test = isinstance(rian.get('base'), str) self.assertTrue(test) with self.subTest(cmd="rian.get('workspace')"): test = isinstance(rian.get('workspace'), str) self.assertTrue(test) with self.subTest(cmd="rian.get('default')"): test = isinstance(rian.get('default'), dict) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype')"): test = isinstance(rian.get('default', 'filetype'), dict) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype', 'dataset')"): filetype = rian.get('default', 'filetype', 'dataset') test = isinstance(filetype, str) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype', 'network')"): filetype = rian.get('default', 'filetype', 'network') test = isinstance(filetype, str) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype', 'system')"): filetype = rian.get('default', 'filetype', 'system') test = isinstance(filetype, str) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype', 'model')"): filetype = rian.get('default', 'filetype', 'model') test = isinstance(filetype, str) self.assertTrue(test) with self.subTest(cmd="rian.get('default', 'filetype', 'script')"): filetype = rian.get('default', 'filetype', 'script') test = isinstance(filetype, str) self.assertTrue(test)
def _update_keypress(self): """Check Keyboard.""" char = rian.get('shell', 'inkey') if not char: return True if char == 'e': pass elif char == 'h': ui.info( "Keyboard Shortcuts\n" "'e' -- calculate evaluation function\n" "'h' -- show this\n" "'q' -- quit optimization\n" "'t' -- estimate finishing time") elif char == 'q': ui.info('aborting optimization') self._buffer['continue'] = False elif char == 't': ftime = self._get_estimatetime() ui.info('estimated finishing time %s' % ftime) return True
def test_workspace_open(self) -> None: rian.open('testsuite') test = rian.get('workspace') == 'testsuite' self.assertTrue(test)
def tearDown(self) -> None: # open previous workspace if rian.get('workspace') != self.workspace: rian.open(self.workspace) rian.set('mode', self.mode)
def setUp(self) -> None: self.mode = rian.get('mode') self.workspace = rian.get('workspace') rian.set('mode', 'silent') # open workspace 'testsuite' rian.open('testsuite', base='site')