diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-04-19 14:55:20 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-04-19 14:55:20 -0400 |
commit | 3f75545c7baf8544f24b23303f91e879703643d8 (patch) | |
tree | 35349f293dedeeeb0b24404885be1e2718d4870e /test_six.py | |
parent | a47db2f576108590756b8e5360bf29b6f02a9ab0 (diff) | |
download | six-3f75545c7baf8544f24b23303f91e879703643d8.tar.gz |
add iterbytes and indexbytes
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py index 8fcd4d4..7e15a1c 100644 --- a/test_six.py +++ b/test_six.py @@ -356,6 +356,17 @@ def test_int2byte(): py.test.raises((OverflowError, ValueError), six.int2byte, 256) +def test_bytesindex(): + assert six.indexbytes(six.b("hello"), 3) == ord("l") + + +def test_bytesiter(): + it = six.iterbytes(six.b("hi")) + assert six.next(it) == ord("h") + assert six.next(it) == ord("i") + py.test.raises(StopIteration, six.next, it) + + def test_StringIO(): fp = six.StringIO() fp.write(six.u("hello")) |