Files
micropython/tests/ports/webassembly/py_proxy_has.mjs
Andrea Giammarchi e33a0f4682 webassembly/objpyproxy: Avoid throwing on symbol or iterator has-check.
JavaScript code uses "Symbol in object" to brand check its own proxies, and
such checks should also work on the Python side.

Signed-off-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
2025-07-04 15:08:03 +10:00

14 lines
335 B
JavaScript

// Test `<attr> in <py-obj>` on the JavaScript side, which tests PyProxy.has.
const mp = await (await import(process.argv[2])).loadMicroPython();
mp.runPython(`
x = []
`);
const x = mp.globals.get("x");
console.log("no_exist" in x);
console.log("sort" in x);
console.log(Symbol.toStringTag in x);
console.log(Symbol.iterator in x);