Files
micropython/tests/ports/webassembly/py_proxy_own_keys.mjs
2024-03-22 14:31:25 +11:00

12 lines
301 B
JavaScript

// Test `Reflect.ownKeys(<py-obj>)` on the JavaScript side, which tests PyProxy.ownKeys.
const mp = await (await import(process.argv[2])).loadMicroPython();
mp.runPython(`
x = []
y = {"a": 1}
`);
console.log(Reflect.ownKeys(mp.globals.get("x")));
console.log(Reflect.ownKeys(mp.globals.get("y")));