Fix issues reported by static checks

This commit is contained in:
Adrián Chaves 2022-06-21 12:02:56 +02:00
parent 3fc9b732cb
commit d2accf2e39
2 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,8 @@ _CONTENT_ENCODING_MIME_TYPES = {
'gzip': b'application/gzip',
}
_MIME_TYPES = MimeTypes()
_MIME_TYPES.readfp(StringIO(get_data('scrapy', 'mime.types').decode()))
_scrapy_mime_data = get_data('scrapy', 'mime.types') or b''
_MIME_TYPES.readfp(StringIO(_scrapy_mime_data.decode()))
def _is_other_text_mime_type(mime_type):

View File

@ -174,8 +174,8 @@ class ResponseTypesTest(unittest.TestCase):
def test_custom_mime_types_loaded(self):
"""Check that mime.types files shipped with Scrapy are loaded."""
self.assertEqual(
_MIME_TYPES.guess_type('x.scrapytest')[0],
'x-scrapy/test',
_MIME_TYPES.guess_type('x.scrapytest')[0],
'x-scrapy/test',
)