From 25cb47c8229c857655472e796e18a2f7a24c6d59 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Tue, 2 Jun 2020 11:24:30 +0200 Subject: [PATCH 1/7] Stop using deprecated smart_text --- django_inlinecss/templatetags/inlinecss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_inlinecss/templatetags/inlinecss.py b/django_inlinecss/templatetags/inlinecss.py index c778ddf..82b9728 100644 --- a/django_inlinecss/templatetags/inlinecss.py +++ b/django_inlinecss/templatetags/inlinecss.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django import template -from django.utils.encoding import smart_text +from django.utils.encoding import smart_str from django_inlinecss import conf @@ -23,7 +23,7 @@ def render(self, context): for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: - path = smart_text(path) + path = smart_str(path) css_loader = conf.get_css_loader()() css = ''.join((css, css_loader.load(path))) From ded937a8546871111d6a66f7870dca0e29157ebd Mon Sep 17 00:00:00 2001 From: Facundo Maero Date: Tue, 2 Jun 2020 11:29:25 +0200 Subject: [PATCH 2/7] Update supported Python versions --- .travis.yml | 9 ++- README.md | 6 +- django_inlinecss/conf.py | 6 -- django_inlinecss/css_loaders.py | 9 +-- django_inlinecss/engines.py | 9 +-- django_inlinecss/templatetags/inlinecss.py | 5 -- django_inlinecss/tests/test_css_loaders.py | 9 +-- django_inlinecss/tests/test_templatetags.py | 13 ++-- setup.py | 69 ++++++++------------- test_settings.py | 5 -- 10 files changed, 42 insertions(+), 98 deletions(-) diff --git a/.travis.yml b/.travis.yml index d7e53f1..f93400c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: python python: - - 2.7 - - 3.4 - - 3.5 - - 3.6 + - 3.8 + - 3.9 + - 3.10 env: - - DJANGO_VERSION=1.11 + - DJANGO_VERSION=3.2 install: - pip install -q Django==$DJANGO_VERSION - pip install -e .[flake8,tests] diff --git a/README.md b/README.md index 3a67942..dbf4e07 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.png?branch=master)](https://travis-ci.org/roverdotcom/django-inlinecss) +[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.svg?branch=master)](https://travis-ci.org/roverdotcom/django-inlinecss) ## About @@ -14,8 +14,8 @@ template language. - BeautifulSoup - cssutils -- Python 2.7+,3.4+ -- Django 1.11+ +- Python 3.8+ +- Django 3.2+ #### Step 2: Install django_inlinecss diff --git a/django_inlinecss/conf.py b/django_inlinecss/conf.py index dc0448e..eea6976 100644 --- a/django_inlinecss/conf.py +++ b/django_inlinecss/conf.py @@ -1,9 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - - try: import importlib except ImportError: diff --git a/django_inlinecss/css_loaders.py b/django_inlinecss/css_loaders.py index 3021874..c3253bc 100644 --- a/django_inlinecss/css_loaders.py +++ b/django_inlinecss/css_loaders.py @@ -1,13 +1,8 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import staticfiles_storage -class BaseCSSLoader(object): +class BaseCSSLoader: def __init__(self): pass @@ -28,7 +23,7 @@ def load(self, path): expanded_path = finders.find(path) if expanded_path is None: - raise IOError('{} does not exist'.format(path)) + raise OSError(f'{path} does not exist') with open(expanded_path, 'rb') as css_file: return css_file.read().decode('utf-8') diff --git a/django_inlinecss/engines.py b/django_inlinecss/engines.py index 55ab018..8de801d 100644 --- a/django_inlinecss/engines.py +++ b/django_inlinecss/engines.py @@ -1,14 +1,7 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -from builtins import object - import pynliner -class EngineBase(object): +class EngineBase: def __init__(self, html, css): self.html = html self.css = css diff --git a/django_inlinecss/templatetags/inlinecss.py b/django_inlinecss/templatetags/inlinecss.py index 82b9728..70a4bde 100644 --- a/django_inlinecss/templatetags/inlinecss.py +++ b/django_inlinecss/templatetags/inlinecss.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django import template from django.utils.encoding import smart_str diff --git a/django_inlinecss/tests/test_css_loaders.py b/django_inlinecss/tests/test_css_loaders.py index f79a1c2..fe969c3 100644 --- a/django_inlinecss/tests/test_css_loaders.py +++ b/django_inlinecss/tests/test_css_loaders.py @@ -1,11 +1,6 @@ """ Test CSS loaders """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.conf import settings from django.test import TestCase from django.test import override_settings @@ -18,7 +13,7 @@ class StaticfilesFinderCSSLoaderTestCase(TestCase): def setUp(self): self.loader = StaticfilesFinderCSSLoader() - super(StaticfilesFinderCSSLoaderTestCase, self).setUp() + super().setUp() def test_loads_existing_css_file(self): css = self.loader.load('bar.css') @@ -34,7 +29,7 @@ def test_load_file_does_not_exist(self): class StaticfilesStorageCSSLoaderTestCase(TestCase): def setUp(self): self.loader = StaticfilesStorageCSSLoader() - super(StaticfilesStorageCSSLoaderTestCase, self).setUp() + super().setUp() def test_loads_existing_css_file(self): css = self.loader.load('bar.css') diff --git a/django_inlinecss/tests/test_templatetags.py b/django_inlinecss/tests/test_templatetags.py index 06d6227..9430444 100644 --- a/django_inlinecss/tests/test_templatetags.py +++ b/django_inlinecss/tests/test_templatetags.py @@ -4,11 +4,6 @@ The actual CSS inlining displayed here is extremely simple: tests of the CSS selector functionality is independent. """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import os from django.conf import settings @@ -16,12 +11,12 @@ from django.test import TestCase from django.test.utils import override_settings from django.utils.safestring import mark_safe -from mock import patch +from unittest.mock import patch class InlinecssTests(TestCase): def setUp(self): - super(InlinecssTests, self).setUp() + super().setUp() def assert_foo_and_bar_rendered(self, rendered): foo_div_regex = ( @@ -119,13 +114,13 @@ def test_unicode_context_variables(self): template = get_template('unicode_context_variables.html') rendered = template.render({ - 'unicode_string': u'I love playing with my pi\xf1ata'}) + 'unicode_string': 'I love playing with my pi\xf1ata'}) self.assertRegex( rendered, '
') self.assertRegex( rendered, - u'I love playing with my pi\xf1ata') + 'I love playing with my pi\xf1ata') def test_comments_are_ignored(self): """ diff --git a/setup.py b/setup.py index c1ff0c5..bf021c3 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -import io import os import sys from shutil import rmtree @@ -13,22 +6,20 @@ from setuptools import find_packages from setuptools import setup - # Package meta-data. -NAME = 'django-inlinecss' -SRC_DIR = 'django_inlinecss' -DESCRIPTION = 'A Django app useful for inlining CSS (primarily for e-mails)' -URL = 'https://github.com/roverdotcom/django-inlinecss' -EMAIL = 'philip@rover.com' -AUTHOR = 'Philip Kimmey' -REQUIRES_PYTHON = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7' +NAME = "django-inlinecss" +SRC_DIR = "django_inlinecss" +DESCRIPTION = "A Django app useful for inlining CSS (primarily for e-mails)" +URL = "https://github.com/roverdotcom/django-inlinecss" +EMAIL = "philip@rover.com" +AUTHOR = "Philip Kimmey" +REQUIRES_PYTHON = ">=3.8" VERSION = None # What packages are required for this module to be executed? REQUIRED = [ - 'Django>=1.11', - 'pynliner', - 'future>=0.16.0', + "Django>=3.2", + "pynliner", ] # What packages are required only for tests? @@ -41,7 +32,7 @@ # What packages are optional? EXTRAS = { 'flake8': [ - 'flake8==3.6.0', + 'flake8==3.8.0', 'flake8-isort==2.6.0', 'isort==4.3.4', 'testfixtures==6.3.0', @@ -56,13 +47,7 @@ # Note: this will only work if 'README.md' is present in your MANIFEST.in file! try: - # Python 3 will raise FileNotFoundError instead of IOError - FileNotFoundError = IOError -except NameError: - pass - -try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: long_description = '\n' + f.read() except FileNotFoundError: long_description = DESCRIPTION @@ -85,7 +70,7 @@ class UploadCommand(Command): @staticmethod def status(s): """Prints things in bold.""" - print('\033[1m{0}\033[0m'.format(s)) + print(f'\033[1m{s}\033[0m') def initialize_options(self): pass @@ -101,13 +86,13 @@ def run(self): pass self.status('Building Source and Wheel (universal) distribution…') - os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) + os.system(f'{sys.executable} setup.py sdist bdist_wheel --universal') self.status('Uploading the package to PyPI via Twine…') os.system('twine upload dist/*') self.status('Pushing git tags…') - os.system('git tag v{0}'.format(about['__version__'])) + os.system('git tag v{}'.format(about['__version__'])) os.system('git push --tags') sys.exit() @@ -128,20 +113,18 @@ def run(self): zip_safe=False, keywords=['html', 'css', 'inline', 'style', 'email'], classifiers=[ - 'Environment :: Other Environment', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Topic :: Communications :: Email', - 'Topic :: Text Processing :: Markup :: HTML', + "Environment :: Other Environment", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Communications :: Email", + "Topic :: Text Processing :: Markup :: HTML", ], install_requires=REQUIRED, tests_require=TESTS, diff --git a/test_settings.py b/test_settings.py index 08b5b85..0a91aa4 100644 --- a/test_settings.py +++ b/test_settings.py @@ -9,11 +9,6 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import os From c20d44524ff32708497bda29fdf234a35778209b Mon Sep 17 00:00:00 2001 From: Facundo Maero Date: Fri, 30 Jul 2021 22:18:48 +0200 Subject: [PATCH 3/7] Configure pre-commit --- .pre-commit-config.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..76b6d57 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + - id: check-toml + - id: check-added-large-files + - id: debug-statements + - repo: https://github.com/PyCQA/flake8 + rev: "7.0.0" + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear + - flake8-isort + - repo: https://github.com/psf/black + rev: "24.2.0" + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) + - repo: https://github.com/myint/autoflake + rev: v2.2.1 + hooks: + - id: autoflake From 7cd6bb775af56abad07d748cc78fd2b649c174ed Mon Sep 17 00:00:00 2001 From: Facundo Maero Date: Fri, 30 Jul 2021 22:28:52 +0200 Subject: [PATCH 4/7] Configure flake8 and isort --- setup.cfg | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.cfg b/setup.cfg index 427ef4c..7f5bde3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,18 +2,18 @@ test=pytest [flake8] -max-line-length=120 +application-import-names=django_inlinecss +max-line-length = 88 +extend-ignore = + # Black-incompatible colon spacing. + E203, + # Line jump before binary operator. + W503, +exclude=.tox,build,.eggs [isort] +force_single_line=true skip=.eggs/ -line_length=119 -wrap_length=79 -known_first_party=django_inlinecss -indent=' ' -force_single_line=True -default_section=THIRDPARTY -lines_after_imports=2 -use_parentheses=True [tool:pytest] django_find_project = false From 4bd068d93ebac773b254331878eea0df403835f6 Mon Sep 17 00:00:00 2001 From: Facundo Maero Date: Fri, 30 Jul 2021 20:36:42 +0000 Subject: [PATCH 5/7] Run pre-commit --- MANIFEST.in | 2 +- django_inlinecss/__version__.py | 2 +- django_inlinecss/conf.py | 14 ++-- django_inlinecss/css_loaders.py | 8 +- django_inlinecss/templatetags/inlinecss.py | 11 +-- django_inlinecss/tests/static/foobar.css | 2 +- django_inlinecss/tests/test_css_loaders.py | 19 ++--- django_inlinecss/tests/test_templatetags.py | 86 ++++++++++----------- setup.py | 56 +++++++------- test_settings.py | 86 ++++++++++----------- 10 files changed, 141 insertions(+), 145 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 12119c8..164330d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include README.md -recursive-include django_inlinecss *.py \ No newline at end of file +recursive-include django_inlinecss *.py diff --git a/django_inlinecss/__version__.py b/django_inlinecss/__version__.py index fbf0a5b..cfb0b13 100644 --- a/django_inlinecss/__version__.py +++ b/django_inlinecss/__version__.py @@ -1,3 +1,3 @@ VERSION = (0, 3, 0) -__version__ = '.'.join(map(str, VERSION)) +__version__ = ".".join(map(str, VERSION)) diff --git a/django_inlinecss/conf.py b/django_inlinecss/conf.py index eea6976..726dd92 100644 --- a/django_inlinecss/conf.py +++ b/django_inlinecss/conf.py @@ -3,24 +3,26 @@ except ImportError: from django.utils import importlib -DEFAULT_ENGINE = 'django_inlinecss.engines.PynlinerEngine' -DEFAULT_CSS_LOADER = 'django_inlinecss.css_loaders.StaticfilesStorageCSSLoader' +DEFAULT_ENGINE = "django_inlinecss.engines.PynlinerEngine" +DEFAULT_CSS_LOADER = "django_inlinecss.css_loaders.StaticfilesStorageCSSLoader" def load_class_by_path(path): - i = path.rfind('.') - module_path, class_name = path[:i], path[i + 1:] + i = path.rfind(".") + module_path, class_name = path[:i], path[i + 1 :] module = importlib.import_module(module_path) return getattr(module, class_name) def get_engine(): from django.conf import settings - engine_path = getattr(settings, 'INLINECSS_ENGINE', DEFAULT_ENGINE) + + engine_path = getattr(settings, "INLINECSS_ENGINE", DEFAULT_ENGINE) return load_class_by_path(engine_path) def get_css_loader(): from django.conf import settings - engine_path = getattr(settings, 'INLINECSS_CSS_LOADER', DEFAULT_CSS_LOADER) + + engine_path = getattr(settings, "INLINECSS_CSS_LOADER", DEFAULT_CSS_LOADER) return load_class_by_path(engine_path) diff --git a/django_inlinecss/css_loaders.py b/django_inlinecss/css_loaders.py index c3253bc..9a1aca3 100644 --- a/django_inlinecss/css_loaders.py +++ b/django_inlinecss/css_loaders.py @@ -23,10 +23,10 @@ def load(self, path): expanded_path = finders.find(path) if expanded_path is None: - raise OSError(f'{path} does not exist') + raise OSError(f"{path} does not exist") - with open(expanded_path, 'rb') as css_file: - return css_file.read().decode('utf-8') + with open(expanded_path, "rb") as css_file: + return css_file.read().decode("utf-8") class StaticfilesStorageCSSLoader(BaseCSSLoader): @@ -34,4 +34,4 @@ def load(self, path): """ Retrieve CSS contents with staticfiles storage """ - return staticfiles_storage.open(path).read().decode('utf-8') + return staticfiles_storage.open(path).read().decode("utf-8") diff --git a/django_inlinecss/templatetags/inlinecss.py b/django_inlinecss/templatetags/inlinecss.py index 70a4bde..a8979a8 100644 --- a/django_inlinecss/templatetags/inlinecss.py +++ b/django_inlinecss/templatetags/inlinecss.py @@ -3,7 +3,6 @@ from django_inlinecss import conf - register = template.Library() @@ -14,14 +13,14 @@ def __init__(self, nodelist, filter_expressions): def render(self, context): rendered_contents = self.nodelist.render(context) - css = '' + css = "" for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: path = smart_str(path) css_loader = conf.get_css_loader()() - css = ''.join((css, css_loader.load(path))) + css = "".join((css, css_loader.load(path))) engine = conf.get_engine()(html=rendered_contents, css=css) return engine.render() @@ -29,13 +28,11 @@ def render(self, context): @register.tag def inlinecss(parser, token): - nodelist = parser.parse(('endinlinecss',)) + nodelist = parser.parse(("endinlinecss",)) # prevent second parsing of endinlinecss parser.delete_first_token() args = token.split_contents()[1:] - return InlineCssNode( - nodelist, - [parser.compile_filter(arg) for arg in args]) + return InlineCssNode(nodelist, [parser.compile_filter(arg) for arg in args]) diff --git a/django_inlinecss/tests/static/foobar.css b/django_inlinecss/tests/static/foobar.css index 6381e58..6239e62 100644 --- a/django_inlinecss/tests/static/foobar.css +++ b/django_inlinecss/tests/static/foobar.css @@ -2,5 +2,5 @@ div.foo { margin: 10px 15px 20px 25px; } div.bar { - padding: 10px 15px 20px 25px; + padding: 10px 15px 20px 25px; } diff --git a/django_inlinecss/tests/test_css_loaders.py b/django_inlinecss/tests/test_css_loaders.py index fe969c3..a8b7ed7 100644 --- a/django_inlinecss/tests/test_css_loaders.py +++ b/django_inlinecss/tests/test_css_loaders.py @@ -1,6 +1,7 @@ """ Test CSS loaders """ + from django.conf import settings from django.test import TestCase from django.test import override_settings @@ -9,21 +10,21 @@ from django_inlinecss.css_loaders import StaticfilesStorageCSSLoader -@override_settings(STATICFILES_DIRS=[settings.STATIC_ROOT], STATIC_ROOT='') +@override_settings(STATICFILES_DIRS=[settings.STATIC_ROOT], STATIC_ROOT="") class StaticfilesFinderCSSLoaderTestCase(TestCase): def setUp(self): self.loader = StaticfilesFinderCSSLoader() super().setUp() def test_loads_existing_css_file(self): - css = self.loader.load('bar.css') - self.assertIn('div.bar {', css) + css = self.loader.load("bar.css") + self.assertIn("div.bar {", css) def test_load_file_does_not_exist(self): with self.assertRaises(IOError) as e: - self.loader.load('missing.css') + self.loader.load("missing.css") - self.assertEqual(str(e.exception), 'missing.css does not exist') + self.assertEqual(str(e.exception), "missing.css does not exist") class StaticfilesStorageCSSLoaderTestCase(TestCase): @@ -32,11 +33,11 @@ def setUp(self): super().setUp() def test_loads_existing_css_file(self): - css = self.loader.load('bar.css') - self.assertIn('div.bar {', css) + css = self.loader.load("bar.css") + self.assertIn("div.bar {", css) def test_load_file_does_not_exist(self): with self.assertRaises(IOError) as e: - self.loader.load('missing.css') + self.loader.load("missing.css") - self.assertEqual(e.exception.strerror, 'No such file or directory') + self.assertEqual(e.exception.strerror, "No such file or directory") diff --git a/django_inlinecss/tests/test_templatetags.py b/django_inlinecss/tests/test_templatetags.py index 9430444..29055f5 100644 --- a/django_inlinecss/tests/test_templatetags.py +++ b/django_inlinecss/tests/test_templatetags.py @@ -4,14 +4,15 @@ The actual CSS inlining displayed here is extremely simple: tests of the CSS selector functionality is independent. """ + import os +from unittest.mock import patch from django.conf import settings from django.template.loader import get_template from django.test import TestCase from django.test.utils import override_settings from django.utils.safestring import mark_safe -from unittest.mock import patch class InlinecssTests(TestCase): @@ -22,25 +23,23 @@ def assert_foo_and_bar_rendered(self, rendered): foo_div_regex = ( r'
' r'\s+This is the "foo" div.\s+' - r'<\/div>') - self.assertRegex( - rendered, - foo_div_regex) + r"<\/div>" + ) + self.assertRegex(rendered, foo_div_regex) bar_div_regex = ( r'
' r'\s+This is the "bar" div.\s+' - r'<\/div>') - self.assertRegex( - rendered, - bar_div_regex) + r"<\/div>" + ) + self.assertRegex(rendered, bar_div_regex) def test_single_staticfiles_css(self): """ Test the basic inlining case of using the staticfiles loader to load a CSS file and inline it as part of a rendering step. """ - template = get_template('single_staticfiles_css.html') + template = get_template("single_staticfiles_css.html") rendered = template.render({}) self.assert_foo_and_bar_rendered(rendered) @@ -50,7 +49,7 @@ def test_multiple_staticfiles_css(self): This tests that passing two css files works. """ - template = get_template('multiple_staticfiles_css.html') + template = get_template("multiple_staticfiles_css.html") rendered = template.render({}) self.assert_foo_and_bar_rendered(rendered) @@ -59,8 +58,8 @@ def test_variable_defined_staticfiles_css(self): Test that the staticfiles paths passed to the templatetag may be defined as variables instead of strings. """ - template = get_template('variable_defined_staticfiles_css.html') - context = {'foo_css': 'foo.css', 'bar_css': 'bar.css'} + template = get_template("variable_defined_staticfiles_css.html") + context = {"foo_css": "foo.css", "bar_css": "bar.css"} rendered = template.render(context) self.assert_foo_and_bar_rendered(rendered) @@ -70,9 +69,8 @@ def test_variable_and_string_defined_staticfiles_css(self): Test that we can mix and match variable-defined CSS files & those defined quoted in the templatetag. """ - template = get_template( - 'variable_and_string_defined_staticfiles_css.html') - context = {'foo_css': 'foo.css'} + template = get_template("variable_and_string_defined_staticfiles_css.html") + context = {"foo_css": "foo.css"} rendered = template.render(context) self.assert_foo_and_bar_rendered(rendered) @@ -81,7 +79,7 @@ def test_inline_css(self): Test that