MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_UnsupportedOperation

Method test_UnsupportedOperation

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

Source from the content-addressed store, hash-verified

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