@@ -18,13 +18,9 @@ class TestTypeAliasPatterns:
1818 ("float32" , "FLOAT32" ),
1919 ("float64" , "FLOAT64" ),
2020 ("int64" , "INT64" ),
21- ("uint64" , "UINT64" ),
2221 ("int32" , "INT32" ),
23- ("uint32" , "UINT32" ),
2422 ("int16" , "INT16" ),
25- ("uint16" , "UINT16" ),
2623 ("int8" , "INT8" ),
27- ("uint8" , "UINT8" ),
2824 ("bool" , "BOOL" ),
2925 ],
3026 )
@@ -41,13 +37,9 @@ def test_type_alias_pattern_matching(self, alias, expected_category):
4137 ("float32" , "float" ),
4238 ("float64" , "double" ),
4339 ("int64" , "bigint" ),
44- ("uint64" , "bigint unsigned" ),
4540 ("int32" , "int" ),
46- ("uint32" , "int unsigned" ),
4741 ("int16" , "smallint" ),
48- ("uint16" , "smallint unsigned" ),
4942 ("int8" , "tinyint" ),
50- ("uint8" , "tinyint unsigned" ),
5143 ("bool" , "tinyint" ),
5244 ],
5345 )
@@ -73,6 +65,26 @@ def test_native_types_still_work(self, native_type, expected_category):
7365 category = match_type (native_type )
7466 assert category == expected_category
7567
68+ @pytest .mark .parametrize (
69+ "native_type,expected_category" ,
70+ [
71+ ("int unsigned" , "INTEGER" ),
72+ ("bigint unsigned" , "INTEGER" ),
73+ ("smallint unsigned" , "INTEGER" ),
74+ ("tinyint unsigned" , "INTEGER" ),
75+ ],
76+ )
77+ def test_native_unsigned_types_pass_through (self , native_type , expected_category ):
78+ """
79+ Test that native MySQL unsigned types are allowed as pass-through.
80+
81+ Note: These are MySQL-specific and not portable to PostgreSQL.
82+ Users should prefer signed core types (int8, int16, int32, int64)
83+ for cross-database compatibility.
84+ """
85+ category = match_type (native_type )
86+ assert category == expected_category
87+
7688
7789class TestTypeAliasTableCreation :
7890 """Test table creation with type aliases."""
@@ -102,13 +114,9 @@ def test_heading_preserves_type_aliases(self, schema_type_aliases):
102114 assert "float32" in heading_str
103115 assert "float64" in heading_str
104116 assert "int64" in heading_str
105- assert "uint64" in heading_str
106117 assert "int32" in heading_str
107- assert "uint32" in heading_str
108118 assert "int16" in heading_str
109- assert "uint16" in heading_str
110119 assert "int8" in heading_str
111- assert "uint8" in heading_str
112120 assert "bool" in heading_str
113121
114122
@@ -125,13 +133,9 @@ def test_insert_and_fetch(self, schema_type_aliases):
125133 val_float32 = 3.14 ,
126134 val_float64 = 2.718281828 ,
127135 val_int64 = 9223372036854775807 , # max int64
128- val_uint64 = 18446744073709551615 , # max uint64
129136 val_int32 = 2147483647 , # max int32
130- val_uint32 = 4294967295 , # max uint32
131137 val_int16 = 32767 , # max int16
132- val_uint16 = 65535 , # max uint16
133138 val_int8 = 127 , # max int8
134- val_uint8 = 255 , # max uint8
135139 val_bool = 1 , # boolean true
136140 )
137141
@@ -142,25 +146,21 @@ def test_insert_and_fetch(self, schema_type_aliases):
142146 assert abs (fetched ["val_float32" ] - test_data ["val_float32" ]) < 0.001
143147 assert abs (fetched ["val_float64" ] - test_data ["val_float64" ]) < 1e-9
144148 assert fetched ["val_int64" ] == test_data ["val_int64" ]
145- assert fetched ["val_uint64" ] == test_data ["val_uint64" ]
146149 assert fetched ["val_int32" ] == test_data ["val_int32" ]
147- assert fetched ["val_uint32" ] == test_data ["val_uint32" ]
148150 assert fetched ["val_int16" ] == test_data ["val_int16" ]
149- assert fetched ["val_uint16" ] == test_data ["val_uint16" ]
150151 assert fetched ["val_int8" ] == test_data ["val_int8" ]
151- assert fetched ["val_uint8" ] == test_data ["val_uint8" ]
152152 assert fetched ["val_bool" ] == test_data ["val_bool" ]
153153
154154 def test_insert_primary_key_with_aliases (self , schema_type_aliases ):
155155 """Test using type aliases in primary key."""
156156 table = TypeAliasPrimaryKey ()
157157 table .delete ()
158158
159- table .insert1 (dict (pk_int32 = 100 , pk_uint16 = 200 , value = "test" ))
160- fetched = (table & dict (pk_int32 = 100 , pk_uint16 = 200 )).fetch1 ()
159+ table .insert1 (dict (pk_int32 = 100 , pk_int16 = 200 , value = "test" ))
160+ fetched = (table & dict (pk_int32 = 100 , pk_int16 = 200 )).fetch1 ()
161161
162162 assert fetched ["pk_int32" ] == 100
163- assert fetched ["pk_uint16 " ] == 200
163+ assert fetched ["pk_int16 " ] == 200
164164 assert fetched ["value" ] == "test"
165165
166166 def test_nullable_type_aliases (self , schema_type_aliases ):
0 commit comments