"The :meth:`_schema.ForeignKey.copy` method is deprecated "
"and will be removed in a future release.",
)
- def copy(self, schema=None):
- return self._copy(schema)
+ def copy(self, schema=None, **kw):
+ return self._copy(schema=schema, **kw)
- def _copy(self, schema=None):
+ def _copy(self, schema=None, **kw):
"""Produce a copy of this :class:`_schema.ForeignKey` object.
The new :class:`_schema.ForeignKey` will not be bound
"is deprecated and will be removed in a future release.",
)
def copy(self, target_table=None, **kw):
- return self._copy(target_table, **kw)
+ return self._copy(target_table=target_table, **kw)
def _copy(self, target_table=None, **kw):
# ticket #5276
"and will be removed in a future release.",
)
def copy(self, target_table=None, **kw):
- return self._copy(target_table, **kw)
+ return self._copy(target_table=target_table, **kw)
def _copy(self, target_table=None, **kw):
if target_table is not None:
"and will be removed in a future release.",
)
def copy(self, schema=None, target_table=None, **kw):
- return self._copy(target_table, **kw)
+ return self._copy(schema=schema, target_table=target_table, **kw)
def _copy(self, schema=None, target_table=None, **kw):
fkc = ForeignKeyConstraint(
from sqlalchemy.testing import not_in
from sqlalchemy.testing.schema import Column
from sqlalchemy.testing.schema import Table
+from sqlalchemy.util import compat
from .test_update import _UpdateFromTestBase
):
self.assert_compile(or_(and_()), "")
+ @testing.combinations(
+ (schema.Column),
+ (schema.UniqueConstraint,),
+ (schema.PrimaryKeyConstraint,),
+ (schema.CheckConstraint,),
+ (schema.ForeignKeyConstraint,),
+ (schema.ForeignKey,),
+ (schema.Identity,),
+ )
+ def test_copy_dep_warning(self, cls):
+ obj = cls.__new__(cls)
+ with mock.patch.object(cls, "_copy") as _copy:
+ with testing.expect_deprecated(
+ r"The %s\(\) method is deprecated" % compat._qualname(cls.copy)
+ ):
+ obj.copy(schema="s", target_table="tt", arbitrary="arb")
+
+ eq_(
+ _copy.mock_calls,
+ [mock.call(target_table="tt", schema="s", arbitrary="arb")],
+ )
+
class ConvertUnicodeDeprecationTest(fixtures.TestBase):