File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1
1
import pythonmonkey as pm
2
2
import sys
3
- from io import StringIO
4
3
5
4
6
5
def test_eval_pyobjects ():
@@ -171,15 +170,4 @@ def test_toPrimitive_stdin():
171
170
172
171
def test_constructor_stdin ():
173
172
constructor = pm .eval ("(obj) => { return obj.constructor; }" )(sys .stdin )
174
- assert repr (constructor ).__contains__ ("<pythonmonkey.JSFunctionProxy object at" )
175
-
176
-
177
- def test_iterable_attribute_console_printing ():
178
- temp_out = StringIO ()
179
- sys .stdout = temp_out
180
- obj = {}
181
- obj ['stdin' ] = sys .stdin # sys.stdin is iterable
182
- assert hasattr (sys .stdin , '__iter__' ) == True
183
- obj ['stdin' ].isTTY = sys .stdin .isatty ()
184
- pm .eval ('''(function iife(obj){console.log(obj['stdin'].isTTY);})''' )(obj )
185
- assert temp_out .getvalue () == "\x1b [33mfalse\x1b [39m\n "
173
+ assert repr (constructor ).__contains__ ("<pythonmonkey.JSFunctionProxy object at" )
Original file line number Diff line number Diff line change @@ -440,3 +440,14 @@ def test_console_array():
440
440
items = [1 , 2 , 3 ]
441
441
pm .eval ('console.log' )(items )
442
442
assert temp_out .getvalue () == "[ \x1b [33m1\x1b [39m, \x1b [33m2\x1b [39m, \x1b [33m3\x1b [39m ]\n "
443
+
444
+
445
+ def test_iterable_attribute_console_printing ():
446
+ temp_out = StringIO ()
447
+ sys .stdout = temp_out
448
+ obj = {}
449
+ obj ['stdin' ] = sys .stdin # sys.stdin is iterable
450
+ assert hasattr (sys .stdin , '__iter__' ) == True
451
+ obj ['stdin' ].isTTY = sys .stdin .isatty ()
452
+ pm .eval ('''(function iife(obj){console.log(obj['stdin'].isTTY);})''' )(obj )
453
+ assert temp_out .getvalue () == "\x1b [33mfalse\x1b [39m\n "
You can’t perform that action at this time.
0 commit comments