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

Method test_UnsupportedOperation

Lib/test/test_zstd.py:2355–2382  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2353 self.assertEqual(dat, SAMPLES[0])
2354
2355 def test_UnsupportedOperation(self):
2356 # 1
2357 with ZstdFile(io.BytesIO(), 'r') as f:
2358 with self.assertRaises(io.UnsupportedOperation):
2359 f.write(b'1234')
2360
2361 # 2
2362 class T:
2363 def read(self, size):
2364 return b'a' * size
2365
2366 with self.assertRaises(TypeError): # on creation
2367 with ZstdFile(T(), 'w') as f:
2368 pass
2369
2370 # 3
2371 with ZstdFile(io.BytesIO(), 'w') as f:
2372 with self.assertRaises(io.UnsupportedOperation):
2373 f.read(100)
2374 with self.assertRaises(io.UnsupportedOperation):
2375 f.seek(100)
2376 self.assertEqual(f.closed, True)
2377 with self.assertRaises(ValueError):
2378 f.readable()
2379 with self.assertRaises(ValueError):
2380 f.tell()
2381 with self.assertRaises(ValueError):
2382 f.read(100)
2383
2384 def test_read_readinto_readinto1(self):
2385 lst = []

Callers

nothing calls this directly

Calls 9

ZstdFileClass · 0.90
TClass · 0.70
assertRaisesMethod · 0.45
writeMethod · 0.45
readMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45
readableMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected