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.
)
def __bool__(self) -> bool:
- return self.empty
+ return not self.empty
def _contains_value(self, value: _T) -> bool:
"Check whether this range contains the given `value`."
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",)