Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #55

Merged
merged 3 commits into from
Nov 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
beautifulsoup4
DataProperty>=0.12.0
jsonschema
pathvalidate>=0.8.3
pytablereader>=0.5.2
pathvalidate>=0.9.0
pytablereader>=0.6.0
path.py
six
xlrd
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setuptools.setup(
name="SimpleSQLite",
version="0.6.3",
version="0.6.4",
url="https://github.com/thombashi/SimpleSQLite",

author="Tsuyoshi Hombashi",
Expand Down
2 changes: 1 addition & 1 deletion test/loader/test_gsloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def monkey_property(self):
@pytest.mark.parametrize(["value", "title", "expected"], [
["%(sheet)s", "titlename", "testsheet"],
["%(title)s", "titlename", "titlename"],
["%(title)s", "table", "table_spreadsheet"],
["%(title)s", "table", "table"],
[
"prefix_%(title)s_%(sheet)s",
"titlename",
Expand Down
3 changes: 1 addition & 2 deletions test/test_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def test_smoke(self, tmpdir, filename):

test_data_file_path = os.path.join(
os.path.dirname(__file__), "data", filename)
loader_factory = ptr.TableFileLoaderFactory(test_data_file_path)
loader = loader_factory.create_from_path()
loader = ptr.TableFileLoader(test_data_file_path)

success_count = 0

Expand Down
35 changes: 35 additions & 0 deletions test/test_simplesqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import itertools

import dataproperty
import pytablereader as ptr
import pytest

from simplesqlite import *
Expand Down Expand Up @@ -818,6 +819,40 @@ def test_null(self, con_null):
TEST_TABLE_NAME, [], [])


class Test_SimpleSQLite_create_table_from_tabledata:

@pytest.mark.parametrize(["value"], [
[
ptr.TableData(
"json1",
["attr_a", "attr_b", "attr_c"],
[
{u'attr_a': 1, u'attr_b': 4, u'attr_c': u'a'},
{u'attr_a': 2, u'attr_b': 2.1, u'attr_c': u'bb'},
{u'attr_a': 3, u'attr_b': 120.9,
u'attr_c': u'ccc'},
]
)
],
])
def test_normal(
self, tmpdir, value):
p_db = tmpdir.join("tmp.db")

con = SimpleSQLite(str(p_db), "w")
con.create_table_from_tabledata(value)

assert con.get_table_name_list() == [value.table_name]
assert con.get_attribute_name_list(
value.table_name) == value.header_list

result = con.select(select="*", table_name=value.table_name)
result_matrix = result.fetchall()
assert len(result_matrix) == 3
assert result_matrix == [
(1, 4.0, u'a'), (2, 2.1, u'bb'), (3, 120.9, u'ccc')]


class Test_SimpleSQLite_create_table_from_csv:

@pytest.mark.parametrize(
Expand Down