Skip to content

Commit

Permalink
style: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
long2ice committed Jan 18, 2024
1 parent 6739e99 commit 78e6e12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion meilisync/source/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
15 changes: 5 additions & 10 deletions tests/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}]

0 comments on commit 78e6e12

Please sign in to comment.