From 69882b41d3eccd303a0e2c2122336208d6034fea Mon Sep 17 00:00:00 2001 From: Mike Perrone Date: Wed, 17 Jan 2024 12:03:42 -0800 Subject: [PATCH] add test showing enums not being converted --- tests/integration/clients/test_postgresql.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/integration/clients/test_postgresql.py b/tests/integration/clients/test_postgresql.py index 27c70e0..8880c99 100644 --- a/tests/integration/clients/test_postgresql.py +++ b/tests/integration/clients/test_postgresql.py @@ -6,6 +6,7 @@ from recap.types import ( BoolType, BytesType, + EnumType, FloatType, IntType, ListType, @@ -30,8 +31,18 @@ def setup_class(cls): dbname="testdb", ) - # Create tables + # Create custom types cursor = cls.connection.cursor() + cursor.execute( + """ + CREATE TYPE test_enum_type_mood AS ENUM ( + 'sad', + 'ok', + 'happy' + ); + """) + + # Create tables cursor.execute( """ CREATE TABLE IF NOT EXISTS test_types ( @@ -55,7 +66,8 @@ def setup_class(cls): test_bit_array BIT(8)[], test_not_null_array INTEGER[] NOT NULL, test_int_array_2d INTEGER[][], - test_text_array_3d TEXT[][][] + test_text_array_3d TEXT[][][], + test_enum_mood test_enum_type_mood ); """ ) @@ -66,6 +78,7 @@ def teardown_class(cls): # Delete tables cursor = cls.connection.cursor() cursor.execute("DROP TABLE IF EXISTS test_types;") + cursor.execute("DROP TYPE IF EXISTS test_enum_type_mood;") cls.connection.commit() # Close the connection @@ -266,6 +279,7 @@ def test_struct_method_arrays_no_enforce_dimensions(self): ), ], ), + EnumType(default=None, symbols=["sad", "ok", "happy"], name="test_enum_mood"), ] validate_results(test_types_struct, expected_fields)