From 1b62daa1ade6e7ce80bc8bbfa344036f6b9bfd0a Mon Sep 17 00:00:00 2001 From: rdimaio Date: Mon, 18 Mar 2024 17:43:54 +0100 Subject: [PATCH] Testing: Remove unnecessary encode to utf-8; #6538 UTF-8 is the default encoding in Python, so there is no need to call encode when UTF-8 is the desired encoding. Instead, use a bytes literal. See also: - https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8/ --- tests/test_dumper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_dumper.py b/tests/test_dumper.py index 94cf3b46f1..2b34572ba1 100644 --- a/tests/test_dumper.py +++ b/tests/test_dumper.py @@ -83,7 +83,7 @@ def test_smart_open_for_bz2_file(): fd, path = tempfile.mkstemp() comp = bz2.BZ2Compressor() with os.fdopen(fd, 'wb') as f: - f.write(comp.compress('abcdef'.encode())) + f.write(comp.compress(b'abcdef')) f.write(comp.flush()) assert not isinstance(dumper.smart_open(path), bz2.BZ2File) os.unlink(path)