From: Mike Bayer Date: Wed, 8 Jun 2022 23:04:23 +0000 (-0400) Subject: add tests to confirm no issue w/ pg json keys X-Git-Tag: rel_2_0_0b1~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=409a2173ebe8a9126911051873b3734e6c6be3f4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add tests to confirm no issue w/ pg json keys Change-Id: Ie91e5efb217c309bc40c3933f538bcf29c1fd87b References: #8112 --- diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index ddb199aa42..266263d5fb 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -3839,6 +3839,33 @@ class JSONRoundTripTest(fixtures.TablesTest): ).fetchall() eq_([d for d, in data], [None]) + @testing.combinations( + "key", + "réve🐍 illé", + 'name_with"quotes"name', + "name with spaces", + "name with ' single ' quotes", + 'some_key("idx")', + argnames="key", + ) + def test_indexed_special_keys(self, connection, key): + data_table = self.tables.data_table + data_element = {key: "some value"} + + connection.execute( + data_table.insert(), + { + "name": "row1", + "data": data_element, + "nulldata": data_element, + }, + ) + + row = connection.execute( + select(data_table.c.data[key], data_table.c.nulldata[key]) + ).one() + eq_(row, ("some value", "some value")) + def test_reflect(self, connection): insp = inspect(connection) cols = insp.get_columns("data_table")