Skip to content

Commit 5c1cd3d

Browse files
more tests for toPrimitive and constructor property
1 parent d036526 commit 5c1cd3d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/python/test_objects.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pythonmonkey as pm
2+
import sys
23

34

45
def test_eval_pyobjects():
@@ -158,5 +159,15 @@ def test_toPrimitive_iterable():
158159

159160
def test_constructor_iterable():
160161
iterable = iter([1,2])
161-
toPrimitive = pm.eval("(obj) => { return obj.constructor; }")(iterable)
162-
assert repr(toPrimitive).__contains__("<pythonmonkey.JSFunctionProxy object at")
162+
constructor = pm.eval("(obj) => { return obj.constructor; }")(iterable)
163+
assert repr(constructor).__contains__("<pythonmonkey.JSFunctionProxy object at")
164+
165+
166+
def test_toPrimitive_stdin():
167+
toPrimitive = pm.eval("(obj) => { return obj[Symbol.toPrimitive]; }")(sys.stdin)
168+
assert repr(toPrimitive).__contains__("<pythonmonkey.JSFunctionProxy object at")
169+
170+
171+
def test_constructor_stdin():
172+
constructor = pm.eval("(obj) => { return obj.constructor; }")(sys.stdin)
173+
assert repr(constructor).__contains__("<pythonmonkey.JSFunctionProxy object at")

0 commit comments

Comments
 (0)