mirror of
https://github.com/pyscript/pyscript.git
synced 2026-05-01 01:00:17 -04:00
kill unwrapped_remote (#1490)
* kill unwrapped_remote * linting * don't use callKwargs for python plugins * fix tests and improve types
This commit is contained in:
@@ -63,12 +63,10 @@ class ExecTestLogger(Plugin):
|
||||
async def beforePyScriptExec(self, interpreter, src, pyScriptTag):
|
||||
console.log(f'beforePyScriptExec called')
|
||||
console.log(f'before_src:{src}')
|
||||
console.log(f'before_id:{pyScriptTag.id}')
|
||||
|
||||
async def afterPyScriptExec(self, interpreter, src, pyScriptTag, result):
|
||||
console.log(f'afterPyScriptExec called')
|
||||
console.log(f'after_src:{src}')
|
||||
console.log(f'after_id:{pyScriptTag.id}')
|
||||
console.log(f'result:{result}')
|
||||
|
||||
|
||||
@@ -88,12 +86,10 @@ class PyReplTestLogger(Plugin):
|
||||
def beforePyReplExec(self, interpreter, src, outEl, pyReplTag):
|
||||
console.log(f'beforePyReplExec called')
|
||||
console.log(f'before_src:{src}')
|
||||
console.log(f'before_id:{pyReplTag.id}')
|
||||
|
||||
def afterPyReplExec(self, interpreter, src, outEl, pyReplTag, result):
|
||||
console.log(f'afterPyReplExec called')
|
||||
console.log(f'after_src:{src}')
|
||||
console.log(f'after_id:{pyReplTag.id}')
|
||||
console.log(f'result:{result}')
|
||||
|
||||
|
||||
@@ -261,9 +257,7 @@ class TestPlugin(PyScriptTest):
|
||||
# These could be made better with a utility function that found log lines
|
||||
# that match a filter function, or start with something
|
||||
assert "before_src:x=2; x" in log_lines
|
||||
assert "before_id:pyid" in log_lines
|
||||
assert "after_src:x=2; x" in log_lines
|
||||
assert "after_id:pyid" in log_lines
|
||||
assert "result:2" in log_lines
|
||||
|
||||
@skip_worker("FIXME: relative paths")
|
||||
@@ -286,9 +280,7 @@ class TestPlugin(PyScriptTest):
|
||||
# These could be made better with a utility function that found log lines
|
||||
# that match a filter function, or start with something
|
||||
assert "before_src:x=2; x" in log_lines
|
||||
assert "before_id:pyid" in log_lines
|
||||
assert "after_src:x=2; x" in log_lines
|
||||
assert "after_id:pyid" in log_lines
|
||||
assert "result:2" in log_lines
|
||||
|
||||
@skip_worker("FIXME: relative paths")
|
||||
|
||||
@@ -29,7 +29,6 @@ describe('RemoteInterpreter', () => {
|
||||
config,
|
||||
stdio,
|
||||
wrapped_remote_interpreter as Synclink.Remote<RemoteInterpreter>,
|
||||
remote_interpreter,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -69,10 +68,6 @@ describe('RemoteInterpreter', () => {
|
||||
expect(interpreter).toBeInstanceOf(InterpreterClient);
|
||||
});
|
||||
|
||||
it('should check if interpreter is an instance of RemoteInterpreter', async () => {
|
||||
expect(interpreter._unwrapped_remote).toBeInstanceOf(RemoteInterpreter);
|
||||
});
|
||||
|
||||
it('should check if interpreter can run python code asynchronously', async () => {
|
||||
expect((await interpreter.run('2+3')).result).toBe(5);
|
||||
});
|
||||
@@ -85,7 +80,7 @@ describe('RemoteInterpreter', () => {
|
||||
|
||||
it('should check if interpreter is able to load a package', async () => {
|
||||
stdio.reset();
|
||||
await interpreter._unwrapped_remote.loadPackage('numpy');
|
||||
await interpreter._remote.loadPackage('numpy');
|
||||
await interpreter.run('import numpy as np');
|
||||
await interpreter.run('x = np.ones((10,))');
|
||||
await interpreter.run('print(x)');
|
||||
|
||||
Reference in New Issue
Block a user