Skip to content

Commit d036526

Browse files
added tests for iterable proxy constructor and Symbol.toPrimitive properties
1 parent b90bf37 commit d036526

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/python/test_objects.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,15 @@ def __init__(self):
148148

149149
o = MyClass()
150150
assert '[object Object]' == pm.eval("(obj) => { return obj.toLocaleString(); }")(o)
151+
152+
153+
def test_toPrimitive_iterable():
154+
iterable = iter([1,2])
155+
toPrimitive = pm.eval("(obj) => { return obj[Symbol.toPrimitive]; }")(iterable)
156+
assert repr(toPrimitive).__contains__("<pythonmonkey.JSFunctionProxy object at")
157+
158+
159+
def test_constructor_iterable():
160+
iterable = iter([1,2])
161+
toPrimitive = pm.eval("(obj) => { return obj.constructor; }")(iterable)
162+
assert repr(toPrimitive).__contains__("<pythonmonkey.JSFunctionProxy object at")

0 commit comments

Comments
 (0)