MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_api

Method test_api

test/test_datapipe.py:232–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

230
231 @skipIfTorchDynamo
232 def test_api(self):
233 fd = TestStreamWrapper._FakeFD("")
234 wrap_fd = StreamWrapper(fd)
235
236 self.assertFalse(fd.opened)
237 self.assertFalse(fd.closed)
238 with self.assertRaisesRegex(IOError, "Cannot read from"):
239 wrap_fd.read()
240
241 wrap_fd.open()
242 self.assertTrue(fd.opened)
243 self.assertEqual("01234", wrap_fd.read())
244
245 del wrap_fd
246 self.assertFalse(fd.opened)
247 self.assertTrue(fd.closed)
248
249 def test_pickle(self):
250 with tempfile.TemporaryFile() as f:

Callers

nothing calls this directly

Calls 5

StreamWrapperClass · 0.90
assertRaisesRegexMethod · 0.80
readMethod · 0.45
openMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected