summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r--lib/sqlalchemy/sql/base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py
index ff44ab27c..5178a7ab1 100644
--- a/lib/sqlalchemy/sql/base.py
+++ b/lib/sqlalchemy/sql/base.py
@@ -553,6 +553,14 @@ class _MetaOptions(type):
def __add__(self, other):
o1 = self()
+
+ if set(other).difference(self._cache_attrs):
+ raise TypeError(
+ "dictionary contains attributes not covered by "
+ "Options class %s: %r"
+ % (self, set(other).difference(self._cache_attrs))
+ )
+
o1.__dict__.update(other)
return o1
@@ -566,6 +574,14 @@ class Options(util.with_metaclass(_MetaOptions)):
def __add__(self, other):
o1 = self.__class__.__new__(self.__class__)
o1.__dict__.update(self.__dict__)
+
+ if set(other).difference(self._cache_attrs):
+ raise TypeError(
+ "dictionary contains attributes not covered by "
+ "Options class %s: %r"
+ % (self, set(other).difference(self._cache_attrs))
+ )
+
o1.__dict__.update(other)
return o1
@@ -589,6 +605,10 @@ class Options(util.with_metaclass(_MetaOptions)):
),
)
+ @classmethod
+ def isinstance(cls, klass):
+ return issubclass(cls, klass)
+
@hybridmethod
def add_to_element(self, name, value):
return self + {name: getattr(self, name) + value}