diff options
| author | Lele Gaifax <lele@metapensiero.it> | 2022-11-27 14:44:13 -0500 |
|---|---|---|
| committer | sqla-tester <sqla-tester@sqlalchemy.org> | 2022-11-27 14:44:13 -0500 |
| commit | 771a5d1a4b517fe56d79caf254e10c12024295ef (patch) | |
| tree | 818095108c18dc36fc601b9800303c19c805de76 /test | |
| parent | db2344b0a2a9ef164651d645a8da2d7a9d1bc250 (diff) | |
| download | sqlalchemy-771a5d1a4b517fe56d79caf254e10c12024295ef.tar.gz | |
Rectify PG Range.__bool__, inverting previous logic
The boolness of the range was defined to be equal to its emptiness. As this has been identified as a typo rather than the intended, this inverts the logic, to match common Python behaviour as well as how other popular PG drivers do.
Closes: #8885
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8885
Pull-request-sha: 5670cdb920692a62f77b7b6ea312784033de83d9
Change-Id: I6f4a40168b2f037c578e84f7550370411bd42160
Diffstat (limited to 'test')
| -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 a7b32f607..ec9bcbae9 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -4410,6 +4410,10 @@ class _RangeComparisonFixtures(_RangeTests): f"{r1} != {r2}: got {r1 != r2}, expected {different}", ) + def test_bool(self): + is_false(bool(Range(empty=True))) + is_true(bool(Range(1, 2))) + class _RangeTypeRoundTrip(_RangeComparisonFixtures, fixtures.TablesTest): __requires__ = ("range_types",) |
