Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_binascii has duplicated tests #109140

Closed
hugovk opened this issue Sep 8, 2023 · 0 comments · Fixed by #109141
Closed

test_binascii has duplicated tests #109140

hugovk opened this issue Sep 8, 2023 · 0 comments · Fixed by #109141
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@hugovk
Copy link
Member

hugovk commented Sep 8, 2023

Bug report

$ python -m pip install ruff
...
$ ruff --select F811 Lib/test/test_binascii.py
Lib/test/test_binascii.py:279:9: F811 Redefinition of unused `test_hex_roundtrip` from line 236
Found 1 error.

Source:

@hypothesis.given(
binary=hypothesis.strategies.binary(),
backtick=hypothesis.strategies.booleans(),
)
def test_hex_roundtrip(self, binary, backtick):
converted = binascii.b2a_uu(self.type2test(binary), backtick=backtick)
restored = binascii.a2b_uu(self.type2test(converted))
self.assertConversion(binary, converted, restored, backtick=backtick)

@hypothesis.given(binary=hypothesis.strategies.binary())
def test_hex_roundtrip(self, binary):
converted = binascii.hexlify(self.type2test(binary))
restored = binascii.unhexlify(self.type2test(converted))
self.assertConversion(binary, converted, restored)

The first test_hex_roundtrip is doing a hexlify/unhexlify roundtrip and is correctly named.

The second test_hex_roundtrip is doing a b2a_uu/a2b_uu roundtrip, so can be renamed like test_b2a_roundtrip.

This was introduced after python/core-workflow#505 (comment).

Linked PRs

@hugovk hugovk added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant