mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-11 01:30:30 +03:00
remove redundant open() arg: encoding='utf8'
By default, open() returns a str: https://docs.python.org/3/library/functions.html#open By default, str is UTF-8: https://docs.python.org/3/library/stdtypes.html#str This used to matter on Python 2.x, but this code is 3.x only now.
This commit is contained in:
parent
6e5d1a6cc3
commit
57556aceee
9 changed files with 27 additions and 27 deletions
|
|
@ -427,7 +427,7 @@ class CommonTest(unittest.TestCase):
|
|||
def test_write_to_config(self):
|
||||
with tempfile.TemporaryDirectory() as tmpPath:
|
||||
cfgPath = os.path.join(tmpPath, 'config.py')
|
||||
with open(cfgPath, 'w', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'w') as f:
|
||||
f.write(textwrap.dedent("""\
|
||||
# abc
|
||||
# test = 'example value'
|
||||
|
|
@ -445,7 +445,7 @@ class CommonTest(unittest.TestCase):
|
|||
fdroidserver.common.write_to_config(cfg, 'test', value='test value', config_file=cfgPath)
|
||||
fdroidserver.common.write_to_config(cfg, 'new_key', value='new', config_file=cfgPath)
|
||||
|
||||
with open(cfgPath, 'r', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'r') as f:
|
||||
self.assertEqual(f.read(), textwrap.dedent("""\
|
||||
# abc
|
||||
test = 'test value'
|
||||
|
|
@ -465,7 +465,7 @@ class CommonTest(unittest.TestCase):
|
|||
with open(cfgPath, 'w') as f:
|
||||
pass
|
||||
fdroidserver.common.write_to_config({}, 'key', 'val', cfgPath)
|
||||
with open(cfgPath, 'r', encoding='utf-8') as f:
|
||||
with open(cfgPath, 'r') as f:
|
||||
self.assertEqual(f.read(), textwrap.dedent("""\
|
||||
|
||||
key = "val"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue