summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/ranges.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/ranges.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ranges.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py
index 9b5834ccd..609af5eb6 100644
--- a/lib/sqlalchemy/dialects/postgresql/ranges.py
+++ b/lib/sqlalchemy/dialects/postgresql/ranges.py
@@ -146,7 +146,7 @@ class Range(Generic[_T]):
return AbstractRange()
def _contains_value(self, value: _T) -> bool:
- """return True if this range contains the given value."""
+ """Return True if this range contains the given value."""
if self.empty:
return False
@@ -289,6 +289,9 @@ class Range(Generic[_T]):
bounds inclusivity, returning ``True`` if they are equal.
"""
+ if not isinstance(other, Range):
+ return NotImplemented
+
if self.empty and other.empty:
return True
elif self.empty != other.empty:
@@ -681,7 +684,7 @@ class AbstractRange(sqltypes.TypeEngine[Range[_T]]):
cls: Type[Union[TypeEngine[Any], TypeEngineMixin]],
**kw: Any,
) -> TypeEngine[Any]:
- """dynamically adapt a range type to an abstract impl.
+ """Dynamically adapt a range type to an abstract impl.
For example ``INT4RANGE().adapt(_Psycopg2NumericRange)`` should
produce a type that will have ``_Psycopg2NumericRange`` behaviors
@@ -808,7 +811,7 @@ class AbstractRange(sqltypes.TypeEngine[Range[_T]]):
class AbstractRangeImpl(AbstractRange[Range[_T]]):
- """marker for AbstractRange that will apply a subclass-specific
+ """Marker for AbstractRange that will apply a subclass-specific
adaptation"""
@@ -821,7 +824,7 @@ class AbstractMultiRange(AbstractRange[Range[_T]]):
class AbstractMultiRangeImpl(
AbstractRangeImpl[Range[_T]], AbstractMultiRange[Range[_T]]
):
- """marker for AbstractRange that will apply a subclass-specific
+ """Marker for AbstractRange that will apply a subclass-specific
adaptation"""