1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Removed default mode='r' argument from calls to open().

This commit is contained in:
Jon Dufresne
2019-01-27 08:30:20 -08:00
committed by Tim Graham
parent ce7293bc91
commit 7e3bf2662b
11 changed files with 43 additions and 43 deletions

View File

@@ -67,7 +67,7 @@ class DumpDataAssertMixin:
primary_keys=primary_keys,
)
if filename:
with open(filename, "r") as f:
with open(filename) as f:
command_output = f.read()
os.remove(filename)
else:
@@ -699,7 +699,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
fixture_json = os.path.join(tests_dir, 'fixtures', 'fixture1.json')
fixture_xml = os.path.join(tests_dir, 'fixtures', 'fixture3.xml')
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_json, 'r')):
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_json)):
management.call_command('loaddata', '--format=json', '-', verbosity=0)
self.assertEqual(Article.objects.count(), 2)
self.assertQuerysetEqual(Article.objects.all(), [
@@ -707,7 +707,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
'<Article: Poker has no place on ESPN>',
])
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_xml, 'r')):
with mock.patch('django.core.management.commands.loaddata.sys.stdin', open(fixture_xml)):
management.call_command('loaddata', '--format=xml', '-', verbosity=0)
self.assertEqual(Article.objects.count(), 3)
self.assertQuerysetEqual(Article.objects.all(), [