summaryrefslogtreecommitdiff
path: root/tests/test_backward.py
blob: 01cc8dac0a7adf6186a1ad5a8ed7f59742f651c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

"""Tests that our version shims in backward.py are working."""

from coverage.backunittest import TestCase
from coverage.backward import iitems, binary_bytes, bytes_to_ints
"""Tests of things from backward.py."""
deftest_iitems(self):
    d = {'a': 1, 'b': 2, 'c': 3}
    items = [('a', 1), ('b', 2), ('c', 3)]
    self.assertCountEqual(list(iitems(d)), items)

    def test_binary_bytes(self):
    byte_values = [0, 255, 17, 23, 42, 57]
    bb = binary_bytes(byte_values)
    assert len(bb) == len(byte_values)
    assert byte_values == list(bytes_to_ints(bb))