@@ -0,0 +1,1482 @@
+#!/usr/bin/env py.test%0A# -*- coding: utf-8 -*-%0A# Created on Fri Apr 25 02:33:04 2014%0A# License is MIT, see COPYING.txt for more details.%0A# @author: Danilo de Jesus da Silva Bellini%0A%0Aimport os, re, pytest%0Afrom fractal import generate_fractal, call_kw, cli_parse_args%0Afrom io import BytesIO%0Afrom pylab import imread, imsave%0A%0A%0Adef show_parameters(fname):%0A  %22%22%22 String with CLI args to show the fractal with the given %60%60fname%60%60 %22%22%22%0A  re_complex = re.compile(%22(?:(%5B+-%5D?%5Cs*%5B0-9.%5D+))?%5Cs*%22%0A                          %22(?:(%5B+-%5D%5Cs*%5B0-9.%5D+)%5Cs*)?(.*)%22)%0A  def part_generator():%0A    for part in fname.rsplit(%22.%22, 1)%5B0%5D.split(%22_%22):%0A      if %22=%22 in part:%0A        yield %22--%22 + part%0A      else:%0A        yield %22 %22.join(filter(lambda x: x, re_complex.match(part).groups()))%0A    yield %22--show%22%0A  return %22 %22.join(part_generator())%0A%0A%0Adef to_dict_params(fname):%0A  %22%22%22 Get full kwargs from file name %22%22%22%0A  return cli_parse_args(show_parameters(fname).split())%0A%0A%0A@pytest.mark.parametrize(%22fname%22, os.listdir(%22images%22))%0Adef test_file_image(fname):%0A  ext = os.path.splitext(fname)%5B-1%5D%5Blen(os.path.extsep):%5D%0A  kwargs = to_dict_params(fname)%0A%0A  # Creates the image in memory%0A  mem = BytesIO()%0A  fractal_data = call_kw(generate_fractal, kwargs)%0A  imsave(mem, fractal_data, cmap=kwargs%5B%22cmap%22%5D, format=ext)%0A  mem.seek(0) # Return stream psition back for reading%0A%0A  # Comparison pixel-by-pixel%0A  img_file = imread(%22images/%22 + fname)%0A  img_mem = imread(mem, format=ext)%0A  assert img_file.tolist() == img_mem.tolist()%0A

Test with each example image in the repository