diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2013-09-28 10:07:55 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-09-28 10:07:55 -0400 |
commit | 5e5cf2d5b9d7decfce16142a7cf7cc140fcbf354 (patch) | |
tree | 42126d750637ec001e5a46046ff76100284faf0b /tests/test_backward.py | |
parent | f859f95e5988d88b580afdb7771f03a8ff612411 (diff) | |
download | python-coveragepy-git-5e5cf2d5b9d7decfce16142a7cf7cc140fcbf354.tar.gz |
More abstractions for bytes objects. Cleans up some version checks in the real code.
Diffstat (limited to 'tests/test_backward.py')
-rw-r--r-- | tests/test_backward.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_backward.py b/tests/test_backward.py index 63ee20d0..e98017ae 100644 --- a/tests/test_backward.py +++ b/tests/test_backward.py @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- """Tests that our version shims in backward.py are working.""" -from coverage.backward import iitems +from coverage.backward import iitems, binary_bytes, byte_to_int, bytes_to_ints from tests.backunittest import TestCase @@ -14,3 +13,10 @@ class BackwardTest(TestCase): d = {'a': 1, 'b': 2, 'c': 3} items = [('a', 1), ('b', 2), ('c', 3)] self.assertSameElements(list(iitems(d)), items) + + def test_binary_bytes(self): + byte_values = [0, 255, 17, 23, 42, 57] + bb = binary_bytes(byte_values) + self.assertEqual(len(bb), len(byte_values)) + self.assertEqual(byte_values, list(bytes_to_ints(bb))) + self.assertEqual(byte_values, [byte_to_int(b) for b in bb]) |