|
|
@ -24,6 +24,7 @@ from pygal import ( |
|
|
|
from pygal._compat import u |
|
|
|
from pygal._compat import u |
|
|
|
from pygal.test.utils import texts |
|
|
|
from pygal.test.utils import texts |
|
|
|
from pygal.test import pytest_generate_tests, make_data |
|
|
|
from pygal.test import pytest_generate_tests, make_data |
|
|
|
|
|
|
|
from tempfile import NamedTemporaryFile |
|
|
|
from uuid import uuid4 |
|
|
|
from uuid import uuid4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -296,17 +297,17 @@ def test_include_x_axis(Chart): |
|
|
|
|
|
|
|
|
|
|
|
def test_css(Chart): |
|
|
|
def test_css(Chart): |
|
|
|
css = "{{ id }}text { fill: #bedead; }\n" |
|
|
|
css = "{{ id }}text { fill: #bedead; }\n" |
|
|
|
css_file = '/tmp/pygal_custom_style-%s.css' % uuid4() |
|
|
|
with NamedTemporaryFile('w') as f: |
|
|
|
with open(css_file, 'w') as f: |
|
|
|
|
|
|
|
f.write(css) |
|
|
|
f.write(css) |
|
|
|
|
|
|
|
f.flush() |
|
|
|
|
|
|
|
|
|
|
|
config = Config() |
|
|
|
config = Config() |
|
|
|
config.css.append(css_file) |
|
|
|
config.css.append(f.name) |
|
|
|
|
|
|
|
|
|
|
|
chart = Chart(config) |
|
|
|
chart = Chart(config) |
|
|
|
chart.add('/', [10, 1, 5]) |
|
|
|
chart.add('/', [10, 1, 5]) |
|
|
|
svg = chart.render().decode('utf-8') |
|
|
|
svg = chart.render().decode('utf-8') |
|
|
|
assert '#bedead' in svg |
|
|
|
assert '#bedead' in svg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_inline_css(Chart): |
|
|
|
def test_inline_css(Chart): |
|
|
|