import pyexcel
from StringIO import StringIO


class TestTutorial05:
    def test_tutorial05_example1(self):
        content="Column 1,Column 2,Column 3\n1,4,7\n2,5,8\n3,6,9"
        reader = pyexcel.SeriesReader(("csv", StringIO(content)))
        reader.column["Column 2"] = [11, 12, 13]
        assert reader.column["Column 2"] == {"Column 2": [11, 12, 13]}

    def test_tutorial05_example2(self):
        content="Column 1,Column 2,Column 3\n1,4,7\n2,5,8\n3,6,9"
        reader = pyexcel.SeriesReader(("csv", StringIO(content)))
        del reader.column["Column 2"]
        try:
            reader.column["Column 2"]
            assert 1==2
        except ValueError:
            assert 1==1

@@ -12,21 +12,82 @@
 cel%0A
-from StringIO
+import six%0Aif six.PY2:%0A    from StringIO import StringIO%0Aelse:%0A    from io
  imp
@@ -752,8 +752,582 @@
 rt 1==1%0A
+%0A    def test_tutorial05_example3(self):%0A        content=%22Column 1,Column 2,Column 3%5Cn1,4,7%5Cn2,5,8%5Cn3,6,9%22%0A        reader = pyexcel.SeriesReader((%22csv%22, StringIO(content)))%0A        print(reader.column%5B%22Column 3%22%5D) %0A        extra_data = %5B%0A            %5B%22Column 4%22, %22Column 5%22%5D,%0A            %5B10, 13%5D,%0A            %5B11, 14%5D,%0A            %5B12, 15%5D%0A        %5D%0A        reader.column += extra_data%0A        print(pyexcel.utils.to_dict(reader))%0A        assert reader.column%5B%22Column 4%22%5D == %7B%22Column 4%22: %5B10, 11, 12%5D%7D%0A        assert reader.column%5B%22Column 5%22%5D == %7B%22Column 5%22: %5B13, 14, 15%5D%7D%0A

fix py3 StringIO