Skip to content

Commit

Permalink
Update test_jsproxy_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Hood committed Jan 16, 2021
1 parent 5faea48 commit fa8dc7f
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/tests/test_jsproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ def test_jsproxy_dir(selenium):
result = selenium.run_js(
"""
window.a = { x : 2, y : "9" };
window.b = function(){};
return pyodide.runPython(`
from js import a
dir(a)
from js import b
[dir(a), dir(b)]
`);
"""
)
assert set(result).issuperset(
[
"__bool__",
"__call__",
"__class__",
"__defineGetter__",
"__defineSetter__",
"__delattr__",
"__delitem__",
"constructor",
"new",
"toString",
"typeof",
"valueOf",
"x",
]
)
jsproxy_items = set([
"__bool__",
"__class__",
"__defineGetter__",
"__defineSetter__",
"__delattr__",
"__delitem__",
"constructor",
"toString",
"typeof",
"valueOf",
"x",
])
callable_items = set(["__call__", "new"])
set1 = set(result[1])
set2 = set(result[2])
assert set1.issuperset(jsproxy_items)
assert set2.issuperset(jsproxy_items)
assert set1.isdisjoint(callable_items)
assert set2.issuperset(callable_items)


def test_jsproxy_getattr(selenium):
Expand Down

0 comments on commit fa8dc7f

Please sign in to comment.