Skip to content

Commit 1d8b141

Browse files
committed
CR: just use class method (Query().into -> Query.into)
1 parent 8822c88 commit 1d8b141

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pypika/tests/test_inserts.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,24 @@ class InsertIntoWithDict(unittest.TestCase):
173173
table_abc = Table("abc")
174174

175175
def test_inserting_simple_dictionary(self):
176-
q = Query().into(self.table_abc).insert_dict({"c1": "value", "c2": 1})
176+
q = Query.into(self.table_abc).insert_dict({"c1": "value", "c2": 1})
177177
self.assertEqual("INSERT INTO \"abc\" (\"c1\",\"c2\") VALUES ('value',1)", str(q))
178178

179179
def test_inserting_dictionary_goes_through_value_quoting_logic(self):
180-
q = Query().into(self.table_abc).insert_dict({"num": 1, "timestamp": datetime(2023, 4, 18)})
180+
q = Query.into(self.table_abc).insert_dict({"num": 1, "timestamp": datetime(2023, 4, 18)})
181181
self.assertEqual("INSERT INTO \"abc\" (\"num\",\"timestamp\") VALUES (1,'2023-04-18T00:00:00')", str(q))
182182

183183
def test_inserting_dictionary_produces_builder(self):
184-
q = Query().into(self.table_abc).insert_dict({"num": 1, "timestamp": datetime(2023, 4, 18)})
184+
q = Query.into(self.table_abc).insert_dict({"num": 1, "timestamp": datetime(2023, 4, 18)})
185185
q = q.insert(2, datetime(2023, 4, 19))
186186
self.assertEqual("INSERT INTO \"abc\" (\"num\",\"timestamp\") VALUES (1,'2023-04-18T00:00:00'),(2,'2023-04-19T00:00:00')", str(q))
187187

188188
def test_columns_is_not_allowed_with_insert_dict(self):
189189
with self.assertRaises(QueryException):
190-
Query().into(self.table_abc).columns("a", "b").insert_dict({"num": 1})
190+
Query.into(self.table_abc).columns("a", "b").insert_dict({"num": 1})
191191

192192
with self.assertRaises(QueryException):
193-
Query().into(self.table_abc).insert_dict({"num": 1}).columns("a", "b")
193+
Query.into(self.table_abc).insert_dict({"num": 1}).columns("a", "b")
194194

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

0 commit comments

Comments
 (0)