MCPcopy Index your code
hub / github.com/python/cpython / test_input_gh130163

Method test_input_gh130163

Lib/test/test_builtin.py:1863–1884  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1861 fp.close()
1862
1863 def test_input_gh130163(self):
1864 class X(io.StringIO):
1865 def __getattribute__(self, name):
1866 nonlocal patch
1867 if patch:
1868 patch = False
1869 sys.stdout = X()
1870 sys.stderr = X()
1871 sys.stdin = X('input\n')
1872 support.gc_collect()
1873 return io.StringIO.__getattribute__(self, name)
1874
1875 with (support.swap_attr(sys, 'stdout', None),
1876 support.swap_attr(sys, 'stderr', None),
1877 support.swap_attr(sys, 'stdin', None)):
1878 patch = False
1879 # the only references:
1880 sys.stdout = X()
1881 sys.stderr = X()
1882 sys.stdin = X('input\n')
1883 patch = True
1884 input() # should not crash
1885
1886 # test_int(): see test_int.py for tests of built-in function int().
1887

Callers

nothing calls this directly

Calls 2

inputFunction · 0.85
XClass · 0.70

Tested by

no test coverage detected