Skip to content

Commit

Permalink
run pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
edvardm committed Nov 22, 2024
1 parent bf01939 commit 4f0330f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pypika/tests/test_inserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def test_insert_with_statement(self):
'WITH sub_qs AS (SELECT "id" FROM "abc") INSERT INTO "abc" SELECT "sub_qs"."id" FROM sub_qs', str(q)
)


class InsertIntoWithDict(unittest.TestCase):
table_abc = Table("abc")

Expand All @@ -183,7 +184,10 @@ def test_inserting_dictionary_goes_through_value_quoting_logic(self):
def test_inserting_dictionary_produces_builder(self):
q = Query.into(self.table_abc).insert_dict({"num": 1, "timestamp": datetime(2023, 4, 18)})
q = q.insert(2, datetime(2023, 4, 19))
self.assertEqual("INSERT INTO \"abc\" (\"num\",\"timestamp\") VALUES (1,'2023-04-18T00:00:00'),(2,'2023-04-19T00:00:00')", str(q))
self.assertEqual(
"INSERT INTO \"abc\" (\"num\",\"timestamp\") VALUES (1,'2023-04-18T00:00:00'),(2,'2023-04-19T00:00:00')",
str(q),
)

def test_columns_is_not_allowed_with_insert_dict_even_with_matching_columns(self):
with self.assertRaisesRegex(QueryException, "Cannot mix use of columns.*and insert_dict"):
Expand All @@ -192,6 +196,7 @@ def test_columns_is_not_allowed_with_insert_dict_even_with_matching_columns(self
with self.assertRaisesRegex(QueryException, "Cannot mix use of columns.*and insert_dict"):
Query.into(self.table_abc).insert_dict({"num": 1, "key": "foo"}).columns("num", "key")


class PostgresInsertIntoOnConflictTests(unittest.TestCase):
table_abc = Table("abc")

Expand Down

0 comments on commit 4f0330f

Please sign in to comment.