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

Method test_pyfile_newstdprinter

Lib/test/test_capi/test_file.py:173–192  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

171 # CRASHES asfd(NULL)
172
173 def test_pyfile_newstdprinter(self):
174 # Test PyFile_NewStdPrinter()
175 pyfile_newstdprinter = _testcapi.pyfile_newstdprinter
176
177 file = pyfile_newstdprinter(STDOUT_FD)
178 self.assertEqual(file.closed, False)
179 self.assertIsNone(file.encoding)
180 self.assertEqual(file.mode, "w")
181
182 self.assertEqual(file.fileno(), STDOUT_FD)
183 self.assertEqual(file.isatty(), os.isatty(STDOUT_FD))
184
185 # flush() is a no-op
186 self.assertIsNone(file.flush())
187
188 # close() is a no-op
189 self.assertIsNone(file.close())
190 self.assertEqual(file.closed, False)
191
192 support.check_disallow_instantiation(self, type(file))
193
194 def test_pyfile_newstdprinter_write(self):
195 # Test the write() method of PyFile_NewStdPrinter()

Callers

nothing calls this directly

Calls 6

assertIsNoneMethod · 0.80
assertEqualMethod · 0.45
filenoMethod · 0.45
isattyMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected