summaryrefslogtreecommitdiff
path: root/test/ext/test_mutable.py
Commit message (Collapse)AuthorAgeFilesLines
* Implement in-place mutation operators for MutableSet, MutableListMike Bayer2017-06-051-0/+60
| | | | | | | | | | | Implemented in-place mutation operators ``__ior__``, ``__iand__``, ``__ixor__`` and ``__isub__`` for :class:`.mutable.MutableSet` and ``__iadd__`` for :class:`.mutable.MutableList` so that change events are fired off when these mutator methods are used to alter the collection. Change-Id: Ib357a96d3b06c5deb6b53eb304a8b9f1dc9e9ede Fixes: #3853
* Add AttributeEvents.modifiedMike Bayer2017-05-231-0/+16
| | | | | | | | | | Added new event handler :meth:`.AttributeEvents.modified` which is triggered when the func:`.attributes.flag_modified` function is invoked, which is common when using the :mod:`sqlalchemy.ext.mutable` extension module. Change-Id: Ic152f1d5c53087d780b24ed7f1f1571527b9e8fc Fixes: #3303
* Ensure we check that SQL expression has an .info attributeMike Bayer2017-04-041-2/+4
| | | | | | | | | | Fixed regression released in 1.1.8 due to :ticket:`3950` where the deeper search for information about column types in the case of a "schema type" or a :class:`.TypeDecorator` would produce an attribute error if the mapping also contained a :obj:`.column_property`. Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931 Fixes: #3956
* Track SchemaEventTarget types in as_mutable()Mike Bayer2017-03-301-0/+43
| | | | | | | | | | | | | | Fixed bug in :mod:`sqlalchemy.ext.mutable` where the :meth:`.Mutable.as_mutable` method would not track a type that had been copied using :meth:`.TypeEngine.copy`. This became more of a regression in 1.1 compared to 1.0 because the :class:`.TypeDecorator` class is now a subclass of :class:`.SchemaEventTarget`, which among other things indicates to the parent :class:`.Column` that the type should be copied when the :class:`.Column` is. These copies are common when using declarative with mixins or abstract classes. Change-Id: Ib04df862c58263185dbae686c548fea3e12c46f1 Fixes: #3950
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-071-2/+2
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Add `sqlalchemy.ext.mutable.MutableSet`pr/236Jeong YunWon2016-02-131-1/+195
| | | | from https://bitbucket.org/zzzeek/sqlalchemy/issues/3297
* Add `sqlalchemy.ext.mutable.MutableList`Jeong YunWon2016-02-131-1/+218
|
* - Further fixes to :ticket:`3605`, pop method on :class:`.MutableDict`,Mike Bayer2015-12-171-1/+16
| | | | | where the "default" argument was not included. fixes #3605
* - Added support for the ``dict.pop()`` and ``dict.popitem()`` methodsMike Bayer2015-12-111-0/+32
| | | | | to the :class:`.mutable.MutableDict` class. fixes #3605
* - Fixed regression in the :mod:`sqlalchemy.ext.mutable` extensionMike Bayer2015-05-211-9/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | as a result of the bugfix for :ticket:`3167`, where attribute and validation events are no longer called within the flush process. The mutable extension was relying upon this behavior in the case where a column level Python-side default were responsible for generating the new value on INSERT or UPDATE, or when a value were fetched from the RETURNING clause for "eager defaults" mode. The new value would not be subject to any event when populated and the mutable extension could not establish proper coercion or history listening. A new event :meth:`.InstanceEvents.refresh_flush` is added which the mutable extension now makes use of for this use case. fixes #3427 - Added new event :meth:`.InstanceEvents.refresh_flush`, invoked when an INSERT or UPDATE level default value fetched via RETURNING or Python-side default is invoked within the flush process. This is to provide a hook that is no longer present as a result of :ticket:`3167`, where attribute and validation events are no longer called within the flush process. - Added a new semi-public method to :class:`.MutableBase` :meth:`.MutableBase._get_listen_keys`. Overriding this method is needed in the case where a :class:`.MutableBase` subclass needs events to propagate for attribute keys other than the key to which the mutable type is associated with, when intercepting the :meth:`.InstanceEvents.refresh` or :meth:`.InstanceEvents.refresh_flush` events. The current example of this is composites using :class:`.MutableComposite`.
* flake8 some testsMike Bayer2015-05-211-56/+84
|
* Merge branch 'mutable-dict-update' of ↵Mike Bayer2014-08-251-0/+12
|\ | | | | | | https://bitbucket.org/goodscloud/sqlalchemy into pr27
| * add update() support to MutableDictMatt Chisholm2014-08-091-0/+12
| |
* | Merge branch 'mutable-dict-coerce-fix' of ↵Mike Bayer2014-08-251-0/+53
|\ \ | | | | | | | | | https://bitbucket.org/goodscloud/sqlalchemy into pr27
| * | fix MutableDict.coerceMatt Chisholm2014-08-091-0/+53
| |/ | | | | | | If a class inherited from MutableDict (say, for instance, to add an update() method), coerce() would give back an instance of MutableDict instead of an instance of the derived class.
* | fix test ordering issuesMike Bayer2014-07-271-62/+38
|/
* Return the assigned value in MultableDict.setdefaultThomas Herve2014-06-241-2/+2
|
* - Fixed bug in mutable extension where :class:`.MutableDict` did notMike Bayer2014-05-141-0/+17
| | | | | report change events for the ``setdefault()`` dictionary operation. fixes #3051
* - Fixed bug in mutable extension as well asMike Bayer2014-03-191-0/+11
| | | | | | :func:`.attributes.flag_modified` where the change event would not be propagated if the attribute had been reassigned to itself. fixes #2997
* - Removed some now unneeded version checks [ticket:2829] courtesy alex gaynorMike Bayer2013-09-221-6/+0
|
* - add a test for pullreq 8Mike Bayer2013-06-231-0/+26
| | | | - simplify
* Fixed bug where :class:`.MutableDict` didn't report a change eventMike Bayer2013-06-031-0/+12
| | | | | when ``clear()`` was called. [ticket:2730]
* The :class:`.MutableComposite` type did not allow for theMike Bayer2012-12-031-0/+71
| | | | | | | | | | | :meth:`.MutableBase.coerce` method to be used, even though the code seemed to indicate this intent, so this now works and a brief example is added. As a side-effect, the mechanics of this event handler have been changed so that new :class:`.MutableComposite` types no longer add per-type global event handlers. Also in 0.7.10 [ticket:2624]
* cleanupMike Bayer2012-12-031-24/+24
|
* - hstore adjustmentsMike Bayer2012-11-171-39/+13
|
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-5/+5
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* another py3k fixMike Bayer2012-01-281-0/+4
|
* - [bug] Fixed bug where unpickled object didn'tMike Bayer2012-01-281-5/+27
| | | | | | | | have enough of its state set up to work correctly within the unpickle() event established by the mutable object extension, if the object needed ORM attribute access within __eq__() or similar. [ticket:2362]
* - [bug] the value of a composite attribute is nowMike Bayer2011-10-261-7/+36
| | | | | | | | | | | | | | | | | expired after an insert or update operation, instead of regenerated in place. This ensures that a column value which is expired within a flush will be loaded first, before the composite is regenerated using that value. [ticket:2309] - [bug] The fix in [ticket:2309] also emits the "refresh" event when the composite value is loaded on access, even if all column values were already present, as is appropriate. This fixes the "mutable" extension which relies upon the "load" event to ensure the _parents dictionary is up to date, fixes [ticket:2308]. Thanks to Scott Torborg for the test case here.
* - Fixed bug in the mutable extension wherebyMike Bayer2011-07-011-0/+18
| | | | | | | if None or a non-corresponding type were set, an error would be raised. None is now accepted which assigns None to all attributes, illegal values raise ValueError.
* - Fixed bug in the mutable extension wherebyMike Bayer2011-06-301-1/+4
| | | | | | if the same type were used twice in one mapping, the attributes beyond the first would not get instrumented.
* - Repaired new "mutable" extension to propagateMike Bayer2011-06-041-3/+107
| | | | | | events to subclasses correctly; don't create multiple event listeners for subclasses either. [ticket:2180]
* py3k test fixMike Bayer2011-05-141-2/+1
|
* - Fixed bugs in sqlalchemy.ext.mutable extension whereMike Bayer2011-05-141-1/+26
| | | | | | `None` was not appropriately handled, replacement events were not appropriately handled. [ticket:2143]
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-7/+7
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace
* - remove @testing.resolve_artifact_names, replace with direct attributeMike Bayer2011-03-261-7/+4
| | | | | | | access to the cls/self.tables/classes registries - express orm/_base.py ORMTest in terms of engine/_base.py TablesTest, factor out common steps into TablesTest, remove AltEngineTest as a separate class. will further consolidate these base classes
* - oracle fixesMike Bayer2011-01-151-5/+5
|
* - add support for pickling with mutable scalars, mutable compositesMike Bayer2011-01-021-13/+60
| | | | | | | - add pickle/unpickle events to ORM events. these are needed for the mutable extension. - finish mutable extension documentation, consolidate examples, add full descriptions
* - whitespace removal bonanzaMike Bayer2011-01-021-25/+24
|
* - add length to varcharsMike Bayer2010-12-311-2/+2
|
* - removes the "on_" prefix.Mike Bayer2010-12-301-3/+3
|
* - they don't want "on_". First step, change the naming convention on EventsMike Bayer2010-12-301-4/+4
| | | | so that non-events are just _name.
* - mutable examples now move into sqlalchemy.ext.mutableMike Bayer2010-12-291-0/+238
- streamline interfaces, get Mutable/MutableComposite to be as minimal in usage as possible - docs for mutable, warnings regrarding mapper events being global - move MutableType/mutable=True outwards, move orm tests to its own module, note in all documentation - still need more events/tests for correct pickling support of composites, mutables. in the case of composites its needed even without mutation. see [ticket:2009]