diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-06-02 22:19:26 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-06-02 22:19:26 -0700 |
commit | fd2d224e3f99ddd65859f11583380746bffd20fa (patch) | |
tree | 2b0ecac5f309e083917cc1e9aac5c2008a7ebe8c /test_six.py | |
parent | 023bffc477711dc659a4195f02b2087989e3d3ff (diff) | |
download | six-git-fd2d224e3f99ddd65859f11583380746bffd20fa.tar.gz |
add byte2int (fixes #26)
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py index 7e15a1c..3983528 100644 --- a/test_six.py +++ b/test_six.py @@ -356,6 +356,12 @@ def test_int2byte(): py.test.raises((OverflowError, ValueError), six.int2byte, 256) +def test_byte2int(): + assert six.byte2int(six.b("\x03")) == 3 + assert six.byte2int(six.b("\x03\x04")) == 3 + py.test.raises(IndexError, six.byte2int, six.b("")) + + def test_bytesindex(): assert six.indexbytes(six.b("hello"), 3) == ord("l") |