OLD | NEW |
(Empty) | |
| 1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 |
| 2 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt |
| 3 |
| 4 """Tests that our version shims in backward.py are working.""" |
| 5 |
| 6 from coverage.backunittest import TestCase |
| 7 from coverage.backward import iitems, binary_bytes, byte_to_int, bytes_to_ints |
| 8 |
| 9 |
| 10 class BackwardTest(TestCase): |
| 11 """Tests of things from backward.py.""" |
| 12 |
| 13 def test_iitems(self): |
| 14 d = {'a': 1, 'b': 2, 'c': 3} |
| 15 items = [('a', 1), ('b', 2), ('c', 3)] |
| 16 self.assertCountEqual(list(iitems(d)), items) |
| 17 |
| 18 def test_binary_bytes(self): |
| 19 byte_values = [0, 255, 17, 23, 42, 57] |
| 20 bb = binary_bytes(byte_values) |
| 21 self.assertEqual(len(bb), len(byte_values)) |
| 22 self.assertEqual(byte_values, list(bytes_to_ints(bb))) |
| 23 self.assertEqual(byte_values, [byte_to_int(b) for b in bb]) |
OLD | NEW |