# Path: databuild/adapters/locmem/models.py
# class LocMemBook(BaseWorkBook):
#     sheet_class = LocMemSheet
# 
# Path: databuild/adapters/base/importer.py
# class Importer(object):
#     def __init__(self, workbook, relative_path):
#     def import_data(self, format, filename, sheet_name=None, *args, **kwargs):
#     def import_csv(self, filename, sheet_name, headers=None, encoding='utf-8', replace=False, skip_first_lines=0, skip_last_lines=0, guess_types=True, **kwargs):
#     def import_json(self, filename, sheet_name, headers=None, encoding='utf-8', replace=False, **kwargs):


import os
from unittest import TestCase
from databuild.adapters.locmem.models import LocMemBook
from databuild.adapters.base.exceptions import DoesNotExist
from databuild.adapters.base import importer
        sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet1', guess_types=False)

        acqui_test = {
            "Codice Comune": '6001',
            "Comune": "Acqui Terme",
            "Totale Maschi": '9510',
            "Totale Femmine": '10939',
            "Maschi+Femmine": '20449'
        }

        acqui = sheet.get(Comune="Acqui Terme")
        assert acqui == acqui_test

        short_sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet2', guess_types=False)

        short_sheet.get(Comune="Voltaggio")
        guessed_sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet4', skip_last_lines=1)

        acqui_test = {
            "Codice Comune": 6001,
            "Comune": "Acqui Terme",
            "Totale Maschi": 9510,
            "Totale Femmine": 10939,
            "Maschi+Femmine": 20449
        }

        acqui = guessed_sheet.get(Comune="Acqui Terme")
        assert acqui == acqui_test

    def test_import_json(self):

# Path: databuild/adapters/locmem/models.py
# class LocMemBook(BaseWorkBook):
#     sheet_class = LocMemSheet
# 
# Path: databuild/adapters/base/importer.py
# class Importer(object):
#     def __init__(self, workbook, relative_path):
#     def import_data(self, format, filename, sheet_name=None, *args, **kwargs):
#     def import_csv(self, filename, sheet_name, headers=None, encoding='utf-8', replace=False, skip_first_lines=0, skip_last_lines=0, guess_types=True, **kwargs):
#     def import_json(self, filename, sheet_name, headers=None, encoding='utf-8', replace=False, **kwargs):


# Path: databuild/tests/test_importer.py
import os
from unittest import TestCase
from databuild.adapters.locmem.models import LocMemBook
from databuild.adapters.base.exceptions import DoesNotExist
from databuild.adapters.base import importer

        sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet1', guess_types=False)

        acqui_test = {
            "Codice Comune": '6001',
            "Comune": "Acqui Terme",
            "Totale Maschi": '9510',
            "Totale Femmine": '10939',
            "Maschi+Femmine": '20449'
        }

        acqui = sheet.get(Comune="Acqui Terme")
        assert acqui == acqui_test

        short_sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet2', guess_types=False)

        short_sheet.get(Comune="Voltaggio")
        guessed_sheet = dataimporter.import_data('csv', os.path.join(TEST_DATA_DIR, "dataset1.csv"), 'sheet4', skip_last_lines=1)

        acqui_test = {
            "Codice Comune": 6001,
            "Comune": "Acqui Terme",
            "Totale Maschi": 9510,
            "Totale Femmine": 10939,
            "Maschi+Femmine": 20449
        }

        acqui = guessed_sheet.get(Comune="Acqui Terme")
        assert acqui == acqui_test

    def test_import_json(self):

        book = LocMemBook('project1')