Commit Graph

35 Commits

Author SHA1 Message Date
Mike Bayer 9d08c6abc2 - Added the :paramref:.AssociationProxy.info parameter to the
:class:`.AssociationProxy` constructor, to suit the
:attr:`.AssociationProxy.info` accessor that was added in
🎫`2971`.  This is possible because :class:`.AssociationProxy`
is constructed explicitly, unlike a hybrid which is constructed
implicitly via the decorator syntax.
fixes #3551
2015-10-09 18:01:43 -04:00
Mike Bayer 4f6e9ccae9 - Fixed bug in association proxy where an any()/has()
on an relationship->scalar non-object attribute comparison would fail,
e.g.
``filter(Parent.some_collection_to_attribute.any(Child.attr == 'foo'))``
fixes #3397
2015-04-28 19:20:01 -04:00
Mike Bayer a3af638e1a - Fixed more regressions caused by NEVER_SET; comparisons
to transient objects with attributes unset would leak NEVER_SET,
and negated_contains_or_equals would do so for any transient
object as the comparison used only the committed value.
Repaired the NEVER_SET cases, fixes #3371, and also made
negated_contains_or_equals() use state_attr_by_column() just
like a non-negated comparison, fixes #3374
2015-04-20 17:38:03 -04:00
Gilles Dartiguelongue 9fee9cb87e Fix slice addressing of _AssociationList with python3 2015-03-10 14:28:50 -04:00
Mike Bayer 0bf33068f4 - ensure all tests are named test_* 2014-07-30 12:18:33 -04:00
Mike Bayer c8873b31f0 - critically, py.test for unknown reasons *SKIPS* tests that have an __init__() method.
No clue.  nosetests doesn't do this.  concerning that other tests might have the same issue.
2014-05-02 18:43:12 -04:00
Mike Bayer d6e8d5eddb - Fixed bug in association proxy where assigning an empty slice
(e.g. ``x[:] = [...]``) would fail on Py3k.
2014-03-04 10:59:27 -05:00
Mike Bayer b6428219c6 - Fixed a regression in association proxy caused by 🎫2810 which
caused a user-provided "getter" to no longer receive values of ``None``
when fetching scalar values from a target that is non-present.  The
check for None introduced by this change is now moved into the default
getter, so a user-provided getter will also again receive values of
None.
re: #2810
2014-02-27 13:29:59 -05:00
Mike Bayer 91ae63569d - catch the metadata on ScalarTest.test_scalar_proxy, this has been leaving itself
around for a long time
- association proxy now returns None for proxied scalar that is also None, rather
than raising AttributeError. [ticket:2810]
2013-10-25 17:56:53 -04:00
Mike Bayer 99732dd29b correct for missing fail() methods which were lost when we removed unittest.TestCase 2013-08-26 12:30:33 -04:00
Mike Bayer 938a8eb403 clean up formatting and other linting issues 2013-08-26 12:29:27 -04:00
Mike Bayer a341e1ccc9 also clarified the changelog regarding Cls.scalar != 'value' 2013-06-08 13:39:20 -04:00
Mike Bayer 20d1e9c3fa Added additional criterion to the ==, != comparators, used with
scalar values, for comparisons to None to also take into account
the association record itself being non-present, in addition to the
existing test for the scalar endpoint on the association record
being NULL.  Previously, comparing ``Cls.scalar == None`` would return
records for which ``Cls.associated`` were present and
``Cls.associated.scalar`` is None, but not rows for which
``Cls.associated`` is non-present.  More significantly, the
inverse operation ``Cls.scalar != None`` *would* return ``Cls``
rows for which ``Cls.associated`` was non-present.

Additionally, added a special use case where you
can call ``Cls.scalar.has()`` with no arguments,
when ``Cls.scalar`` is a column-based value - this returns whether or
not ``Cls.associated`` has any rows present, regardless of whether
or not ``Cls.associated.scalar`` is NULL or not.
[ticket:2751]
2013-06-08 13:23:15 -04:00
Mike Bayer 4b614b9b35 - the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
2013-04-27 19:53:57 -04:00
Mike Bayer 6ae1e89961 - these pickle the assoc proxy by itself tests can't really pass
now without strong ref on the parent
- fix message compare for py3k
2013-04-20 05:34:40 -04:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
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.
2012-09-27 02:37:33 -04:00
Mike Bayer 22ba1c43b7 -whitespace bonanza, contd 2012-07-28 17:05:50 -04:00
Mike Bayer ae90ba28e8 fix import here 2012-04-24 16:03:51 -04:00
Mike Bayer 1cf80dc5b2 - Changed the update() method on association proxy
dictionary to use a duck typing approach, i.e.
    checks for "keys", to discern between update({})
    and update((a, b)).   Previously, passing a
    dictionary that had tuples as keys would be misinterpreted
    as a sequence. [ticket:2275]
2011-09-14 11:31:33 -04:00
Mike Bayer 4fe4590a45 - rewrite the docs for association proxy using declarative, add new examples, querying,
etc., part of [ticket:2246]
- add some accessors to AssociationProxy for attributes, test in join(), [ticket:2236]
- update relationship docs to talk about callables, part of [ticket:2246]
2011-08-05 21:29:21 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer a3083eabf4 - move all the setup_classes(cls) and setup_mappers(cls) to use a
local cls.Basic, cls.Comparable base class so that there is no ambiguity
or hash identity behaviors getting in the way of class registration.
2011-03-27 15:04:06 -04:00
Mike Bayer 14a2fae239 - remove @testing.resolve_artifact_names, replace with direct attribute
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
2011-03-26 19:03:11 -04:00
Mike Bayer 2722035809 - Association proxy now has correct behavior for
any(), has(), and contains() when proxying
a many-to-one scalar attribute to a one-to-many
collection (i.e. the reverse of the 'typical'
association proxy use case)  [ticket:2054]
2011-02-13 20:20:34 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer e1402efb19 - move sqlalchemy.test to test.lib 2010-11-15 19:37:50 -05:00
Mike Bayer f2b43da1a8 tidy test/base, test/ex, test/ext 2010-07-11 13:41:38 -04:00
Mike Bayer c6bceb7775 - converted all lazy=True|False|None to 'select'|'joined'|'noload'
- converted all eager to joined in examples
- fixed beaker/advanced.py to reference RelationshipCache
2010-03-24 19:19:03 -04:00
Mike Bayer 065fcbd9d2 - The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term.  relation() however will remain available
in equal capacity for the foreseeable future.  [ticket:1740]
2010-03-17 17:48:29 -04:00
Mike Bayer 67f5f4831b - fix the sqlalchemy.test.schema.Column function to work with copies
- add sequences to new associationproxy tests
- test/ext passes 100% on oracle here
2010-03-11 18:01:04 +00:00
Mike Bayer 2d15d9b0d0 - association_proxy now has basic comparator methods .any(),
.has(), .contains(), ==, !=, thanks to Scott Torborg.
[ticket:1372]
2010-01-22 20:24:27 +00:00
Mike Bayer dc1fc3a897 - The signature of the proxy_factory callable passed to
association_proxy is now (lazy_collection, creator,
value_attr, association_proxy), adding a fourth argument
that is the parent AssociationProxy argument.  Allows
serializability and subclassing of the built in collections.
[ticket:1259]
2009-12-08 23:09:48 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer ed8742e685 - The collection proxies produced by associationproxy are now
pickleable.  A user-defined proxy_factory however
is still not pickleable unless it defines __getstate__
and __setstate__. [ticket:1446]
2009-07-25 17:08:38 +00:00
Mike Bayer 45cec095b4 - unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run
the tests.  [ticket:970]
2009-06-10 21:18:24 +00:00