Skip to content

Commit

Permalink
Testing: Remove unnecessary encode to utf-8; rucio#6538
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
rdimaio authored and voetberg committed Apr 15, 2024
1 parent 1b58ad0 commit ea8924f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_dumper.py
Expand Up @@ -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)
Expand Down

0 comments on commit ea8924f

Please sign in to comment.