@pytest.mark.skipif((not cairosvg), reason='CairoSVG not installed')
def test_render_to_png(Chart, datas):
 file_name = ('/tmp/test_graph-%s.png' % uuid.uuid4())
 if os.path.exists(file_name):
  os.remove(file_name)
 chart = Chart()
 chart = make_data(chart, datas)
 chart.render_to_png(file_name)
 png = chart._repr_png_()
 with open(file_name, 'rb') as f:
  assert (png == f.read())
 os.remove(file_name)

@ pytest . mark . skipif ( ( not cairosvg ) , reason = 'CairoSVG not installed' ) def test_render_to_png ( Chart , datas ) : file_name = ( '/tmp/test_graph-%s.png' % uuid . uuid4 ( ) ) if os . path . exists ( file_name ) : os . remove ( file_name ) chart = Chart ( ) chart = make_data ( chart , datas ) chart . render_to_png ( file_name ) png = chart . _repr_png_ ( ) with open ( file_name , 'rb' ) as f : assert ( png == f . read ( ) ) os . remove ( file_name )
test in file png rendering .