Skip to content

Commit

Permalink
add tests for LOGICAL_SLOT_SUFFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
toluaina committed Jun 11, 2024
1 parent ff14226 commit 3f5d5ba
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,32 @@ def test_parse_logical_slot(
pg_base.parse_logical_slot(row)
assert '"Unknown UNKNOWN operation for row:' in str(excinfo.value)

def test_parse_logical_slot_with_double_precision(
self,
connection,
):
pg_base = Base(connection.engine.url.database)
row = """
table public.book: UPDATE: id[integer]:1 isbn[character varying]:'001' title[character varying]:'It' description[character varying]:'Stephens Kings It' copyright[character varying]:null tags[jsonb]:'["a", "b", "c"]' doc[jsonb]:'{"a": {"b": {"c": [0, 1, 2, 3, 4]}}, "i": 73, "x": [{"y": 0, "z": 5}, {"y": 1, "z": 6}], "bool": true, "lastname": "Judye", "firstname": "Glenda", "generation": {"name": "X"}, "nick_names": ["Beatriz", "Jean", "Carilyn", "Carol-Jean", "Sara-Ann"], "coordinates": {"lat": 21.1, "lon": 32.9}}' publisher_id[integer]:1 publish_date[timestamp without time zone]:'1980-01-01 00:00:00' quad[double precision]:2e+58
""" # noqa E501
payload = pg_base.parse_logical_slot(row)
assert payload.data == {
"id": 1,
"isbn": "001",
"title": "It",
"description": "Stephens",
"copyright": None,
"tags": "'",
"doc": "'",
"publisher_id": 1,
"publish_date": "'1980-01-01",
"quad": 2e58,
}
assert payload.old == {}
assert payload.schema == "public"
assert payload.table == "book"
assert payload.tg_op == "UPDATE"

def test_fetchone(self, connection):
pg_base = Base(connection.engine.url.database, verbose=True)
with patch("pgsync.base.compiled_query") as mock_compiled_query:
Expand Down

0 comments on commit 3f5d5ba

Please sign in to comment.