Mercurial > public > mercurial-scm > hg
diff tests/test-cbor.py @ 39412:a40d3da89b7d
cborutil: remove readindefinitebytestringtoiter()
This was implemented as part of implementing streaming encoding.
It was never used outside of tests.
Now that we have a full CBOR decoder, it can be used for incremental
decoding of indefinite-length byte strings.
This also removes the last use of the vendored cbor2 package from this
module.
Differential Revision: https://phab.mercurial-scm.org/D4433
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 31 Aug 2018 15:54:17 -0700 |
parents | aeb551a3bb8a |
children | babad5ebaf0a |
line wrap: on
line diff
--- a/tests/test-cbor.py Tue Aug 28 15:02:48 2018 -0700 +++ b/tests/test-cbor.py Fri Aug 31 15:54:17 2018 -0700 @@ -1,6 +1,5 @@ from __future__ import absolute_import -import io import unittest from mercurial.thirdparty import ( @@ -118,16 +117,6 @@ self.assertTrue(b[0].isfirst) self.assertTrue(b[0].islast) - def testreadtoiter(self): - source = io.BytesIO(b'\x5f\x44\xaa\xbb\xcc\xdd\x43\xee\xff\x99\xff') - - it = cborutil.readindefinitebytestringtoiter(source) - self.assertEqual(next(it), b'\xaa\xbb\xcc\xdd') - self.assertEqual(next(it), b'\xee\xff\x99') - - with self.assertRaises(StopIteration): - next(it) - def testdecodevariouslengths(self): for i in (0, 1, 22, 23, 24, 25, 254, 255, 256, 65534, 65535, 65536): source = b'x' * i