From 78e6e1225dbab9338ea9b487155d95ab4f3cb313 Mon Sep 17 00:00:00 2001 From: long2ice Date: Thu, 18 Jan 2024 09:49:27 +0800 Subject: [PATCH] style: fix --- meilisync/source/postgres.py | 2 +- tests/test_postgres.py | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/meilisync/source/postgres.py b/meilisync/source/postgres.py index c00b03c..5172d15 100644 --- a/meilisync/source/postgres.py +++ b/meilisync/source/postgres.py @@ -86,7 +86,7 @@ def _consumer(self, msg: ReplicationMessage): columntypes = change.get("columntypes") for i in range(len(columntypes)): - if columntypes[i] == 'json': + if columntypes[i] == "json": columnvalues[i] = json.loads(columnvalues[i]) if kind == "update": diff --git a/tests/test_postgres.py b/tests/test_postgres.py index 2271a85..76b672f 100644 --- a/tests/test_postgres.py +++ b/tests/test_postgres.py @@ -18,16 +18,11 @@ async def test_sync(): cur = conn.cursor() cur.execute("DROP TABLE IF EXISTS test") cur.execute("CREATE TABLE IF NOT EXISTS test (id INT PRIMARY KEY, age INT, data_json JSON)") - cur.execute("INSERT INTO test (id, age, data_json) VALUES (%s, %s, %s)", (1, 18, '{"name": "test data"}')) + cur.execute( + "INSERT INTO test (id, age, data_json) VALUES (%s, %s, %s)", + (1, 18, '{"name": "test data"}'), + ) conn.commit() time.sleep(2) ret = await index.get_documents() - assert ret.results == [ - { - "id": 1, - "age": 18, - "data_json": { - "name": "test data" - } - } - ] + assert ret.results == [{"id": 1, "age": 18, "data_json": {"name": "test data"}}]