Avoid respecifying default encoding for .encode()/.decode() calls

In Python 3, both .encode() and .decode() default the encoding to
'utf-8'. See the docs:

https://docs.python.org/3/library/stdtypes.html#str.encode
https://docs.python.org/3/library/stdtypes.html#bytes.decode

Simplify and shorten the code by using the default instead of
respecifying it.
This commit is contained in:
Jon Dufresne
2018-12-15 15:43:44 -08:00
parent 6113261948
commit 5bf25eb445
18 changed files with 37 additions and 37 deletions

View File

@@ -47,7 +47,7 @@ def reference_check(app, *args, **kwds):
@mock.patch('sphinx.ext.intersphinx._read_from_url')
def test_fetch_inventory_redirection(_read_from_url, InventoryFile, app, status, warning):
intersphinx_setup(app)
_read_from_url().readline.return_value = '# Sphinx inventory version 2'.encode('utf-8')
_read_from_url().readline.return_value = '# Sphinx inventory version 2'.encode()
# same uri and inv, not redirected
_read_from_url().url = 'http://hostname/' + INVENTORY_FILENAME