Skip to content

Commit

Permalink
Add test for --create-if-not-exists flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jez committed Mar 27, 2017
1 parent c42138c commit c8be8d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/foo1.csv
@@ -0,0 +1,3 @@
id,name,age
1,Jake,22
2,Howard,21
3 changes: 3 additions & 0 deletions examples/foo2.csv
@@ -0,0 +1,3 @@
id,name,age
3,Liz,20
4,Tim,21
4 changes: 4 additions & 0 deletions tests/test_utilities/test_csvsql.py
Expand Up @@ -158,6 +158,10 @@ def test_query_with_prefix(self):

self.get_output(['--prefix', 'OR IGNORE', '--no-create', '--insert', '--db', 'sqlite:///' + self.db_file, 'examples/dummy.csv'])

def test_create_if_not_exists(self):
self.get_output(['--insert', '--create-if-not-exists', '--tables', 'foo', '--db', 'sqlite:///' + self.db_file, 'examples/foo1.csv'])
self.get_output(['--insert', '--create-if-not-exists', '--tables', 'foo', '--db', 'sqlite:///' + self.db_file, 'examples/foo2.csv'])

def test_query(self):
input_file = six.StringIO("a,b,c\n1,2,3\n")

Expand Down

0 comments on commit c8be8d4

Please sign in to comment.