diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-04-18 13:07:19 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-04-21 09:51:28 -0400 |
| commit | 408c936c77c6aaeceab0e0b001ed745ceb9d19d4 (patch) | |
| tree | 3f2508b46b206cd5f2e06cbd4490e46438f24da8 /test/dialect/postgresql | |
| parent | a8b2fbb55c6de302b053b4309c6e53cd7f748448 (diff) | |
| download | sqlalchemy-408c936c77c6aaeceab0e0b001ed745ceb9d19d4.tar.gz | |
Implement UUID.python_type
Implemented :attr:`_postgresql.UUID.python_type` attribute for the
:class:`_postgresql.UUID` type object. The attribute will return either
``str`` or ``uuid.UUID`` based on the :paramref:`_postgresql.UUID.as_uuid`
parameter setting. Previously, this attribute was unimplemented. Pull
request courtesy Alex Grönholm.
Fixes: #7943
Closes: #7944
Change-Id: Ic4fbaeee134d586b08339801968e787cc7e14285
Diffstat (limited to 'test/dialect/postgresql')
| -rw-r--r-- | test/dialect/postgresql/test_types.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index a59dd0ac7..8c4bb7fe7 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -2832,6 +2832,10 @@ class UUIDTest(fixtures.TestBase): ) eq_(v1.fetchone()[0], value1) + def test_python_type(self): + eq_(postgresql.UUID(as_uuid=True).python_type, uuid.UUID) + eq_(postgresql.UUID(as_uuid=False).python_type, str) + class HStoreTest(AssertsCompiledSQL, fixtures.TestBase): __dialect__ = "postgresql" |
