Browse Source

cairosvg python 3

pull/8/head
Florian Mounier 13 years ago
parent
commit
68ca2a4378
  1. 4
      pygal/graph/base.py
  2. 2
      pygal/test/test_graph.py

4
pygal/graph/base.py

@ -205,8 +205,8 @@ class BaseGraph(object):
def render_to_png(self, filename):
import cairosvg
import StringIO
fakefile = StringIO.StringIO()
from io import BytesIO
fakefile = BytesIO()
fakefile.write(self.render())
fakefile.seek(0)
cairosvg.surface.PNGSurface.convert(

2
pygal/test/test_graph.py

@ -61,6 +61,6 @@ def test_render_to_png():
line = Line()
line.add('Serie 1', [1])
line.render_to_png(file_name)
with open(file_name) as f:
with open(file_name, 'rb') as f:
assert f.read()
os.remove(file_name)

Loading…
Cancel
Save