From a1f146b5d63184ba6d21a2176af4665175a64c51 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Tue, 24 Apr 2018 17:14:46 +0100 Subject: [PATCH] fix with python2 --- sass.py | 11 ++--------- sasstests.py | 9 ++------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/sass.py b/sass.py index 2e8b2455..67ee6de3 100644 --- a/sass.py +++ b/sass.py @@ -600,15 +600,8 @@ def _get_file_arg(key): 'custom_import_extensions must be a list of strings ' 'not {}'.format(type(_custom_exts)) ) - custom_import_extensions = [] - for ext in _custom_exts: - if isinstance(ext, text_type): - custom_import_extensions.append(ext.encode('utf-8')) - else: - raise TypeError( - 'custom_import_extensions must be a list of strings ' - 'not {}'.format(type(ext)) - ) + custom_import_extensions = [ext.encode('utf-8') for ext in _custom_exts] + importers = _validate_importers(kwargs.pop('importers', None)) if 'string' in modes: diff --git a/sasstests.py b/sasstests.py index e8d57e8e..c87c3c1d 100644 --- a/sasstests.py +++ b/sasstests.py @@ -1435,19 +1435,14 @@ def test_import_css(exts, tmpdir): assert out == 'body {\n color: green; }\n' -@pytest.mark.parametrize('exts', [ - ['.css', 3], - '.css', - [b'.css'], -]) -def test_import_css_error(exts, tmpdir): +def test_import_css_error(tmpdir): tmpdir.join('other.css').write('body {color: green}') main_scss = tmpdir.join('main.scss') main_scss.write("@import 'other';") with pytest.raises(TypeError): sass.compile( filename=main_scss.strpath, - custom_import_extensions=exts, + custom_import_extensions='.css', )