"""Tests for the EcoData Retriever"""

from StringIO import StringIO
from engine import Engine

def test_escape_single_quotes():
    """Test escaping of single quotes"""
    test_engine = Engine()
    assert test_engine.escape_single_quotes("1,2,3,'a'") == "1,2,3,\\'a\\'"

def test_escape_double_quotes():
    """Test escaping of double quotes"""
    test_engine = Engine()
    assert test_engine.escape_double_quotes('"a",1,2,3') == '\\"a\\",1,2,3'

def test_drop_statement():
    "Test the creation of drop statements"
    test_engine = Engine()
    assert test_engine.drop_statement('TABLE', 'tablename') == "DROP TABLE IF EXISTS tablename"

@@ -87,16 +87,40 @@
 t Engine
+%0Afrom table import Table
 %0A%0Adef te
@@ -662,8 +662,782 @@
 lename%22%0A
+%0Adef test_auto_get_delimiter_comma():%0A    %22%22%22Test if commas are properly detected as delimiter%22%22%22%0A    test_engine = Engine()%0A    test_engine.table = Table(%22test%22)%0A    test_engine.auto_get_delimiter(%22a,b,c;,d%22)%0A    assert test_engine.table.delimiter == %22,%22%0A%0Adef test_auto_get_delimiter_tab():%0A    %22%22%22Test if commas are properly detected as delimiter%22%22%22%0A    test_engine = Engine()%0A    test_engine.table = Table(%22test%22)%0A    test_engine.auto_get_delimiter(%22a%5Ctb%5Ctc%5Ctd,%22)%0A    assert test_engine.table.delimiter == %22%5Ct%22%0A%0Adef test_auto_get_delimiter_semicolon():%0A    %22%22%22Test if commas are properly detected as delimiter%22%22%22%0A    test_engine = Engine()%0A    test_engine.table = Table(%22test%22)%0A    test_engine.auto_get_delimiter(%22a;b;c;,d%22)%0A    assert test_engine.table.delimiter == %22;%22%0A

Add tests of automated identification of the delimiter