diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 14:04:02 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 16:24:37 -0400 |
commit | 775c14a764ff3fd32bcd25d91f4c0f635722ed50 (patch) | |
tree | 2f73d38468b11c4b5f9723265bb121352a13271f /tests | |
parent | e96ef93d18831630687b6c026bed89a1f9149c90 (diff) | |
download | python-coveragepy-git-775c14a764ff3fd32bcd25d91f4c0f635722ed50.tar.gz |
refactor: remove more unneeded backward.py shims
Gone are:
- iitems
- litems
- iternext
- to_bytes
- to_string
- binary_bytes
- byte_to_int
- bytes_to_ints
- BUILTINS
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_backward.py | 24 | ||||
-rw-r--r-- | tests/test_execfile.py | 3 | ||||
-rw-r--r-- | tests/test_numbits.py | 3 |
3 files changed, 2 insertions, 28 deletions
diff --git a/tests/test_backward.py b/tests/test_backward.py deleted file mode 100644 index b40a174b..00000000 --- a/tests/test_backward.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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.backward import iitems, binary_bytes, bytes_to_ints - -from tests.coveragetest import CoverageTest -from tests.helpers import assert_count_equal - - -class BackwardTest(CoverageTest): - """Tests of things from backward.py.""" - - def test_iitems(self): - d = {'a': 1, 'b': 2, 'c': 3} - items = [('a', 1), ('b', 2), ('c', 3)] - assert_count_equal(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)) diff --git a/tests/test_execfile.py b/tests/test_execfile.py index 3cdd1ed9..ec8cd180 100644 --- a/tests/test_execfile.py +++ b/tests/test_execfile.py @@ -14,7 +14,6 @@ import sys import pytest from coverage import env -from coverage.backward import binary_bytes from coverage.execfile import run_python_file, run_python_module from coverage.files import python_reported_file from coverage.misc import NoCode, NoSource @@ -151,7 +150,7 @@ class RunPycFileTest(CoverageTest): # Jam Python 2.1 magic number into the .pyc file. with open(pycfile, "r+b") as fpyc: fpyc.seek(0) - fpyc.write(binary_bytes([0x2a, 0xeb, 0x0d, 0x0a])) + fpyc.write(bytes([0x2a, 0xeb, 0x0d, 0x0a])) with pytest.raises(NoCode, match="Bad magic number in .pyc file"): run_python_file([pycfile]) diff --git a/tests/test_numbits.py b/tests/test_numbits.py index 946f8fcb..98399086 100644 --- a/tests/test_numbits.py +++ b/tests/test_numbits.py @@ -10,7 +10,6 @@ from hypothesis import example, given, settings from hypothesis.strategies import sets, integers from coverage import env -from coverage.backward import byte_to_int from coverage.numbits import ( nums_to_numbits, numbits_to_nums, numbits_union, numbits_intersection, numbits_any_intersection, num_in_numbits, register_sqlite_functions, @@ -33,7 +32,7 @@ if env.METACOV: def good_numbits(numbits): """Assert that numbits is good.""" # It shouldn't end with a zero byte, that should have been trimmed off. - assert (not numbits) or (byte_to_int(numbits[-1]) != 0) + assert (not numbits) or (numbits[-1] != 0) class NumbitsOpTest(CoverageTest): |