From 3fc6296b1f5e4f8f735fd7024101ecdd8f764ed1 Mon Sep 17 00:00:00 2001 From: jaraco Date: Wed, 14 Apr 2010 19:13:16 +0000 Subject: [PATCH] Added test to prevent regression fixed by recent patch --- tests/test_plot.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_plot.py diff --git a/tests/test_plot.py b/tests/test_plot.py new file mode 100644 index 0000000..23822cd --- /dev/null +++ b/tests/test_plot.py @@ -0,0 +1,20 @@ + +import unittest + +class PlotTester(unittest.TestCase): + def test_index_error_2010_04(self): + """ + Reported by Jean Schurger + a 'IndexError: tuple index out of range' when there are only two + values returned by float_range (in the case there are only two + different 'y' values in the data) and 'scale_y_integers == True'. + + Credit to Jean for the test code as well. + """ + from svg.charts.plot import Plot + g = Plot(dict(scale_y_integers = True)) + g.add_data(dict(data=[1, 0, 2, 1], title='foo')) + res = g.burn() + +if __name__ == '__main__': + unittest.main() \ No newline at end of file