Skip to content

Commit

Permalink
fix coverage and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
gleb-kov committed Jun 19, 2021
1 parent 59eeeae commit d25b596
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pypika/queries.py
Expand Up @@ -1857,7 +1857,7 @@ def foreign_key(
reference_table: Union[str, Table],
reference_columns: List[Union[str, Column]],
on_delete: ReferenceOption = None,
on_update: ReferenceOption = None
on_update: ReferenceOption = None,
) -> "CreateQueryBuilder":
"""
Adds a foreign key constraint.
Expand Down
6 changes: 6 additions & 0 deletions pypika/tests/test_create.py
Expand Up @@ -156,6 +156,12 @@ def test_create_table_with_select_and_columns_fails(self):
with self.assertRaises(AttributeError):
Query.create_table(self.new_table).as_select(select).columns(self.foo, self.bar)

with self.subTest("repeated foreign key"):
with self.assertRaises(AttributeError):
Query.create_table(self.new_table) \
.foreign_key([self.foo], self.existing_table, [self.bar]) \
.foreign_key([self.foo], self.existing_table, [self.bar])

def test_create_table_as_select_not_query_raises_error(self):
with self.assertRaises(TypeError):
Query.create_table(self.new_table).as_select("abc")

0 comments on commit d25b596

Please sign in to comment.