/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/tests/test__btree_serializer.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

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])