From 0fb2051fc59dc56e6d470d258d010c520f2f5be3 Mon Sep 17 00:00:00 2001 From: Cristian Sabaila Date: Wed, 3 Nov 2021 01:01:42 +0200 Subject: [PATCH] fix unit tests --- test/dialect/mysql/test_compiler.py | 2 +- test/dialect/mysql/test_on_duplicate.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/dialect/mysql/test_compiler.py b/test/dialect/mysql/test_compiler.py index a6ead333fa..ad1c16edfd 100644 --- a/test/dialect/mysql/test_compiler.py +++ b/test/dialect/mysql/test_compiler.py @@ -1115,7 +1115,7 @@ class InsertOnDuplicateTest(fixtures.TestBase, AssertsCompiledSQL): expected_sql = ( "INSERT INTO foos (id, bar) VALUES (%s, %s), (%s, %s) ON " "DUPLICATE KEY UPDATE bar = coalesce(VALUES(bar)), " - "baz = (concat(VALUES(bar), %s, VALUES(baz)))" + "baz = (concat(VALUES(baz), %s, VALUES(bar)))" ) self.assert_compile( stmt, diff --git a/test/dialect/mysql/test_on_duplicate.py b/test/dialect/mysql/test_on_duplicate.py index 4c8307d907..544227af70 100644 --- a/test/dialect/mysql/test_on_duplicate.py +++ b/test/dialect/mysql/test_on_duplicate.py @@ -101,17 +101,19 @@ class OnDuplicateTest(fixtures.TablesTest): stmt = insert(foos).values([dict(id=1, bar="ab"), dict(id=2, bar="b")]) stmt = stmt.on_duplicate_key_update( bar=func.concat(stmt.inserted.bar, "_foo"), - baz=func.concat(stmt.inserted.bar, foos.baz), + baz=func.concat(stmt.inserted.bar, "_", foos.c.baz), ) result = conn.execute(stmt) eq_(result.inserted_primary_key, (None,)) + # first entry triggers ON DUPLICATE eq_( conn.execute(foos.select().where(foos.c.id == 1)).fetchall(), [(1, "ab_foo", "ab_bz", False)], ) + # second entry should be an insert eq_( - conn.execute(foos.select().where(foos.c.id == 1)).fetchall(), - [(2, "b_foo", "b_bz", False)], + conn.execute(foos.select().where(foos.c.id == 2)).fetchall(), + [(2, "b", None, False)], ) def test_on_duplicate_key_update_preserve_order(self, connection): -- 2.47.3