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

Method test_peek

Lib/test/test_lzma.py:1024–1034  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1022 self.assertRaises(TypeError, f.read1, None)
1023
1024 def test_peek(self):
1025 with LZMAFile(BytesIO(COMPRESSED_XZ)) as f:
1026 result = f.peek()
1027 self.assertGreater(len(result), 0)
1028 self.assertStartsWith(INPUT, result)
1029 self.assertEqual(f.read(), INPUT)
1030 with LZMAFile(BytesIO(COMPRESSED_XZ)) as f:
1031 result = f.peek(10)
1032 self.assertGreater(len(result), 0)
1033 self.assertStartsWith(INPUT, result)
1034 self.assertEqual(f.read(), INPUT)
1035
1036 def test_peek_bad_args(self):
1037 with LZMAFile(BytesIO(), "w") as f:

Callers

nothing calls this directly

Calls 7

LZMAFileClass · 0.90
BytesIOClass · 0.90
assertGreaterMethod · 0.80
assertStartsWithMethod · 0.80
peekMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected