summaryrefslogtreecommitdiff
path: root/test/orm/collection.py
Commit message (Collapse)AuthorAgeFilesLines
* - unit tests have been migrated from unittest to nose.Mike Bayer2009-06-101-1834/+0
| | | | | See README.unittests for information on how to run the tests. [ticket:970]
* - The "clear()", "save()", "update()", "save_or_update()"Mike Bayer2009-01-171-12/+12
| | | | | | Session methods have been deprecated, replaced by "expunge_all()" and "add()". "expunge_all()" has also been added to ScopedSession.
* - Concrete inheriting mappers now instrument attributes which are inherited ↵Mike Bayer2009-01-111-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the superclass, but are not defined for the concrete mapper itself, with an InstrumentedAttribute that issues a descriptive error when accessed. [ticket:1237] - Added a new `relation()` keyword `back_populates`. This allows configuation of backreferences using explicit relations. [ticket:781] This is required when creating bidirectional relations between a hierarchy of concrete mappers and another class. [ticket:1237] - Test coverage added for `relation()` objects specified on concrete mappers. [ticket:1237] - A short documentation example added for bidirectional relations specified on concrete mappers. [ticket:1237] - Mappers now instrument class attributes upon construction with the final InstrumentedAttribute object which remains persistent. The `_CompileOnAttr`/`__getattribute__()` methodology has been removed. The net effect is that Column-based mapped class attributes can now be used fully at the class level without invoking a mapper compilation operation, greatly simplifying typical usage patterns within declarative. [ticket:1269] - Index now accepts column-oriented InstrumentedAttributes (i.e. column-based mapped class attributes) as column arguments. [ticket:1214] - Broke up attributes.register_attribute into two separate functions register_descriptor and register_attribute_impl. The first assembles an InstrumentedAttribute or Proxy descriptor, the second assembles the AttributeImpl inside the InstrumentedAttribute. register_attribute remains for outside compatibility. The argument lists have been simplified. - Removed class_manager argument from all but MutableScalarAttributeImpl (the branch had removed class_ as well but this has been reverted locally to support the serializer extension). - Mapper's previous construction of _CompileOnAttr now moves to a new MapperProperty.instrument_class() method which is called on all MapperProperty objects at the moment the mapper receives them. All MapperProperty objects now call attributes.register_descriptor within that method to assemble an InstrumentedAttribute object directly. - InstrumentedAttribute now receives the "property" attribute from the given PropComparator. The guesswork within the constructor is removed, and allows "property" to serve as a mapper compilation trigger. - RelationProperty.Comparator now triggers compilation of its parent mapper within a util.memoized_property accessor for the "property" attribute, which is used instead of "prop" (we can probably remove "prop"). - ColumnProperty and similar handle most of their initialization in their __init__ method since they must function fully at the class level before mappers are compiled. - SynonymProperty and ComparableProperty move their class instrumentation logic to the new instrument_class() method. - LoaderStrategy objects now add their state to existing InstrumentedAttributes using attributes.register_attribute_impl. Both column and relation-based loaders instrument in the same way now, with a unique InstrumentedAttribute *and* a unique AttributeImpl for each class in the hierarchy. attribute.parententity should now be correct in all cases. - Removed unitofwork.register_attribute, and simpified the _register_attribute methods into a single function in strategies.py. unitofwork exports the UOWEventHandler extension directly. - To accomodate the multiple AttributeImpls across a class hierarchy, the sethasparent() method now uses an optional "parent_token" attribute to identify the "parent". AbstractRelationLoader sends the MapperProperty along to serve as this token. If the token isn't present (which is only the case in the attributes unit tests), the AttributeImpl is used instead, which is essentially the same as the old behavior. - Added new ConcreteInheritedProperty MapperProperty. This is invoked for concrete mappers within _adapt_inherited_property() to accomodate concrete mappers which inherit unhandled attributes from the base class, and basically raises an exception upon access. [ticket:1237] - attributes.register_attribute and register_descriptor will now re-instrument an attribute unconditionally without checking for a previous attribute. Not sure if this is controversial. It's needed so that ConcreteInheritedProperty instrumentation can be overridden by an incoming legit MapperProperty without any complexity. - Added new UninstrumentedColumnLoader LoaderStrategy. This is used by the polymorphic_on argument when the given column is not represented within the mapped selectable, as is typical with a concrete scenario which maps to a polymorphic union. It does not configure class instrumentation, keeping polymorphic_on from getting caught up in the new concrete attribute-checking logic. - RelationProperty now records its "backref" attributes using a set assigned to `_reverse_property` instead of a scalar. The `back_populates` keyword allows any number of properties to be involved in a single bidirectional relation. Changes were needed to RelationProperty.merge(), DependencyProcessor to accomodate for the new multiple nature of this attribute. - Generalized the methodology used by ManyToManyDP to check for "did the other dependency already handle this direction", building on the `_reverse_property` collection. - post_update logic within dependency.py moves to use the same methodology as ManyToManyDP so that "did the other dependency do this already" checks are made to be specific to the two dependent instances. - Caught that RelationProperty.merge() was writing to instance.__dict__ directly (!) - repaired to talk to instance_state.dict. - Removed needless eager loading example from concrete mapper docs. - Added test for [ticket:965]. - Added the usual Node class/nodes table to orm/_fixtures.py, but haven't used it for anything yet. We can potentially update test/orm/query.py to use this fixture. - Other test/documentation cleanup.
* merge the test/ directory from -r5438:5439 of py3k_warnings branch. this givesMike Bayer2008-12-181-0/+1
| | | | us a 2.5-frozen copy of unittest so we're insulated from unittest changes.
* merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 ↵Mike Bayer2008-12-181-1/+9
| | | | | | | | testing issues, and also addresses a significant chunk of py3k deprecations. It's mainly expicit __hash__ methods. Additionally, most usage of sets/dicts to store columns uses util-based placeholder names.
* - Fixed bug preventing declarative-bound "column" objectsMike Bayer2008-11-071-2/+24
| | | | from being used in column_mapped_collection(). [ticket:1174]
* - AttributeListener has been refined such that the eventMike Bayer2008-09-021-1/+5
| | | | | | | | | | | | is fired before the mutation actually occurs. Addtionally, the append() and set() methods must now return the given value, which is used as the value to be used in the mutation operation. This allows creation of validating AttributeListeners which raise before the action actually occurs, and which can change the given value into something else before its used. A new example "validate_attributes.py" shows one such recipe for doing this. AttributeListener helper functions are also on the way.
* - Removed 2.3 set emulations/enhancements.Jason Kirtland2008-07-151-9/+1
| | | | (sets.Set-based collections & DB-API returns still work.)
* Chipping away at remaining cruft.Jason Kirtland2008-05-101-6/+6
|
* Test suite modernization in progress. Big changes:Jason Kirtland2008-05-091-83/+131
| | | | | | | | | | | - @unsupported now only accepts a single target and demands a reason for not running the test. - @exclude also demands an exclusion reason - Greatly expanded @testing.requires.<feature>, eliminating many decorators in the suite and signficantly easing integration of multi-driver support. - New ORM test base class, and a featureful base for mapped tests - Usage of 'global' for shared setup going away, * imports as well
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-3/+3
| | | | 0.4 development continues at /sqlalchemy/branches/rel_0_4
* Adjusted inplace-binops on set-based collections and association proxies toJason Kirtland2008-05-051-0/+10
| | | | | | more closely follow builtin (2.4+) set semantics. Formerly any set duck-type was accepted, now only types or subtypes of set, frozenset or the collection type itself are accepted.
* Fixed duplicate append event emission on repeated instrumented set.add() ↵Jason Kirtland2008-05-051-1/+4
| | | | operations.
* - The collection instrumentation sweep now skips over descriptors that raise ↵Jason Kirtland2008-05-021-0/+18
| | | | AttributeError.
* - merged sync_simplify branchMike Bayer2008-04-041-0/+288
| | | | | | | | | | | | | | | | - The methodology behind "primaryjoin"/"secondaryjoin" has been refactored. Behavior should be slightly more intelligent, primarily in terms of error messages which have been pared down to be more readable. In a slight number of scenarios it can better resolve the correct foreign key than before. - moved collections unit test from relationships.py to collection.py - PropertyLoader now has "synchronize_pairs" and "equated_pairs" collections which allow easy access to the source/destination parent/child relation between columns (might change names) - factored out ClauseSynchronizer (finally) - added many more tests for priamryjoin/secondaryjoin error checks
* - updated the naming scheme of the base test classes in test/testlib/testing.py;Mike Bayer2008-02-111-1/+1
| | | | | tests extend from either TestBase or ORMTest, using additional mixins for special assertion methods as needed
* - 2.3 fixup, part two: 100% passing for sqliteJason Kirtland2008-01-211-6/+14
| | | | | | | | | - added 2.4-style binops to util.Set on 2.3 - OrderedSets pickle on 2.3 - more lib/sqlalchemy set vs Set corrections - fixed InstrumentedSet.discard for 2.3 - set, sorted compatibility for test suite - added testing.fails_if decorator
* - testbase is gone, replaced by testenvJason Kirtland2008-01-121-2/+2
| | | | | | - Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase - testing.db has the configured db - Fixed up the perf/* scripts
* test suite deprecation rampageJason Kirtland2008-01-091-4/+4
|
* More overloads: fix cascades for += on a list relation, added operator ↵Jason Kirtland2008-01-051-0/+25
| | | | support to association proxied lists.
* Refined bulk-assignment aspects of the r3999 in-place collection operator ↵Jason Kirtland2008-01-041-0/+21
| | | | fix. Also? r4000!
* Fixed in-place set mutation operator support [ticket:920]Jason Kirtland2008-01-041-37/+125
|
* - Raise an error when assigning a bogusly keyed dictionary to one of the ↵Jason Kirtland2007-12-141-12/+31
| | | | | | | builtin dict-based collection types [ticket:886] - Collections gain a @converter framework for flexible validation and adaptation of bulk assignment - Bogus bulk assignments now raise TypeError instead of exceptions.ArgumentError
* AttributeManager class and "cached" state removed....attribute listingMike Bayer2007-11-271-22/+21
| | | | is tracked from _sa_attrs class collection
* - split ScalarInstrumentedAttribute into a "scalar" and an "object" version.Mike Bayer2007-10-311-10/+10
| | | | | | | | | | | The "object" version loads the existing value on set/del, fires events, and handles trackparent operations; the "scalar" version does not. - column loaders now use the "scalar" version of InstrumentedAttribute, so that event handlers etc. don't fire off for regular column attribute operations. - some adjustments to AttributeHistory to work properly for non-loaded attributes - deferred column attributes no longer trigger a load operation when the attribute is assigned to. in those cases, the newly assigned value will be present in the flushes' UPDATE statement unconditionally.
* Fixed a truncation error when re-assigning a subset of a collectionJason Kirtland2007-10-311-2/+17
| | | | (obj.relation = obj.relation[1:]) [ticket:834]
* - fix to "row switch" behavior, i.e. when an INSERT/DELETE is combined into aMike Bayer2007-10-301-2/+0
| | | | | | | | single UPDATE; many-to-many relations on the parent object update properly. [ticket:841] - it's an error to session.save() an object which is already persistent [ticket:840] - changed a bunch of repr(obj) calls in session.py exceptions to use mapperutil.instance_str()
* merged current entity_management brach r3457-r3462. cleans upMike Bayer2007-09-051-0/+11
| | | | | | | | '_state' mamangement in attributes, moves __init__() instrumntation into attributes.py, and reduces method call overhead by removing '_state' property. future enhancements may include _state maintaining a weakref to the instance and a strong ref to its __dict__ so that garbage-collected instances can get added to 'dirty', when weak-referenced identity map is used.
* Added test coverage for freeform collection decoratorsJason Kirtland2007-08-051-1/+102
| | | | Decorators with positional arg specs can be called with named args too...
* Added some collections slicing tests that somehow escaped the r3040 commit.Jason Kirtland2007-07-271-1/+16
|
* merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to ↵Mike Bayer2007-07-271-0/+1140
maintenance branch in branches/rel_0_3.