/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test__btree_serializer.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import bisect
22
22
 
23
23
from .. import tests
24
 
from ..sixish import (
25
 
    int2byte,
26
 
    )
27
24
 
28
25
from .test_btree_index import compiled_btreeparser_feature
29
26
 
60
57
        self.assertIs(None, self.module._py_unhexlify(as_hex))
61
58
 
62
59
    def test_to_hex(self):
63
 
        raw_bytes = b''.join(map(int2byte, range(256)))
 
60
        raw_bytes = bytes(range(256))
64
61
        for i in range(0, 240, 20):
65
62
            self.assertHexlify(raw_bytes[i:i + 20])
66
63
        self.assertHexlify(raw_bytes[240:] + raw_bytes[0:4])
70
67
        self.assertUnhexlify(b'123456789abcdef0123456789abcdef012345678')
71
68
        self.assertUnhexlify(b'0123456789ABCDEF0123456789ABCDEF01234567')
72
69
        self.assertUnhexlify(b'123456789ABCDEF0123456789ABCDEF012345678')
73
 
        hex_chars = binascii.hexlify(b''.join(map(int2byte, range(256))))
 
70
        hex_chars = binascii.hexlify(bytes(range(256)))
74
71
        for i in range(0, 480, 40):
75
72
            self.assertUnhexlify(hex_chars[i:i + 40])
76
73
        self.assertUnhexlify(hex_chars[480:] + hex_chars[0:8])