ethereum / hexbytes

Python `bytes` subclass that decodes hex, with a readable console output
MIT License
27 stars 19 forks source link

Slices and single bytes of hexbytes should return hexbytes #8

Closed carver closed 5 years ago

carver commented 5 years ago

Test case examples:

assert repr(HexBytes('0xabcd')[1]) == repr(b'\xab\xcd'[1]) == 205
assert repr(HexBytes('abcdef')[1:2]) == repr(HexBytes('cd')) == "HexBytes('0xcd')"

Real test cases seem like a good candidate for hypothesis testing.

carver commented 5 years ago

Changed my mind about the single item lookup. It should behave like a single item lookup in bytes, which is to return an int.