Skip to content

Commit 7a5787a

Browse files
committed
Applied Black
1 parent 99e90e7 commit 7a5787a

File tree

2 files changed

+40
-22
lines changed

2 files changed

+40
-22
lines changed

csvs_to_sqlite/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ def cli(
168168
sql_type_overrides = None
169169
for name, path in csvs.items():
170170
try:
171-
df = load_csv(path, separator, skip_errors, quoting, shape, just_strings=just_strings)
171+
df = load_csv(
172+
path, separator, skip_errors, quoting, shape, just_strings=just_strings
173+
)
172174
df.table_name = table or name
173175
if filename_column:
174176
df[filename_column] = name

tests/test_csvs_to_sqlite.py

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
The Rock,134.1,9 of June in the year 1996"""
3535

3636

37-
3837
def test_flat():
3938
runner = CliRunner()
4039
with runner.isolated_filesystem():
@@ -329,12 +328,11 @@ def test_filename_column():
329328
assert [("Yolo", "Gary Johnson", 41, "./test1")] == conn.execute(
330329
"select county, candidate, votes, source from [./test1] limit 1"
331330
).fetchall()
332-
assert (
333-
[("The Rock", "Sean Connery", "Nicolas Cage", "./test2")]
334-
== conn.execute(
335-
"select film, actor_1, actor_2, source from [./test2] limit 1"
336-
).fetchall()
337-
)
331+
assert [
332+
("The Rock", "Sean Connery", "Nicolas Cage", "./test2")
333+
] == conn.execute(
334+
"select film, actor_1, actor_2, source from [./test2] limit 1"
335+
).fetchall()
338336

339337

340338
def test_filename_column_with_shape():
@@ -408,12 +406,12 @@ def test_custom_indexes():
408406
)
409407
assert result.exit_code == 0
410408
conn = sqlite3.connect("test.db")
411-
assert (
412-
[('"test_county"', "test"), ('"test_party_candidate"', "test")]
413-
== conn.execute(
414-
'select name, tbl_name from sqlite_master where type = "index" order by name'
415-
).fetchall()
416-
)
409+
assert [
410+
('"test_county"', "test"),
411+
('"test_party_candidate"', "test"),
412+
] == conn.execute(
413+
'select name, tbl_name from sqlite_master where type = "index" order by name'
414+
).fetchall()
417415

418416

419417
def test_dates_and_datetimes():
@@ -501,7 +499,6 @@ def test_just_strings_default():
501499
)
502500
assert result.exit_code == 0
503501

504-
505502
conn = sqlite3.connect("just-strings.db")
506503
assert [
507504
(0, "county", "TEXT", 0, None, 0),
@@ -523,7 +520,15 @@ def test_just_strings_default():
523520
] == rows
524521
last_row = rows[-1]
525522
for i, t in enumerate(
526-
(string_types, string_types, string_types, string_types, string_types, string_types, string_types)
523+
(
524+
string_types,
525+
string_types,
526+
string_types,
527+
string_types,
528+
string_types,
529+
string_types,
530+
string_types,
531+
)
527532
):
528533
assert isinstance(last_row[i], t)
529534

@@ -537,8 +542,13 @@ def test_just_strings_with_shape():
537542
open("test.csv", "w").write(CSV)
538543
result = runner.invoke(
539544
cli.cli,
540-
["test.csv", "test-reshaped-strings.db", "--just-strings",
541-
"--shape", "county:Cty,district:district,votes:Vts(REAL)"],
545+
[
546+
"test.csv",
547+
"test-reshaped-strings.db",
548+
"--just-strings",
549+
"--shape",
550+
"county:Cty,district:district,votes:Vts(REAL)",
551+
],
542552
)
543553
assert result.exit_code == 0
544554
conn = sqlite3.connect("test-reshaped-strings.db")
@@ -573,10 +583,16 @@ def test_just_strings_with_date_specified():
573583
with runner.isolated_filesystem():
574584
open("nic_cages_greatest.csv", "w").write(CSV_STRINGS_AND_DATES)
575585
result = runner.invoke(
576-
cli.cli, ["nic_cages_greatest.csv", "movies.db",
577-
"--date", "release_date",
578-
"--datetime-format", "%d of %B in the year %Y",
579-
"--just-strings"]
586+
cli.cli,
587+
[
588+
"nic_cages_greatest.csv",
589+
"movies.db",
590+
"--date",
591+
"release_date",
592+
"--datetime-format",
593+
"%d of %B in the year %Y",
594+
"--just-strings",
595+
],
580596
)
581597
assert result.exit_code == 0
582598
conn = sqlite3.connect("movies.db")

0 commit comments

Comments
 (0)