summaryrefslogtreecommitdiff
path: root/test/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-10-03 15:55:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-10-04 12:09:29 -0400
commit95d4cd30420414fcede2662aed87b0f2e5a861d4 (patch)
treeb77df1c621fdea15a95a784fae5c76765c117bbd /test/ext
parent728ce8cc480d0ada690e5a97067cff821b9a65f3 (diff)
downloadsqlalchemy-95d4cd30420414fcede2662aed87b0f2e5a861d4.tar.gz
Enhance "raise" strategy to include "raise_on_sql" option
The "raise_on_sql" option differentiates from "raise" in that firing a lazy loader is OK as long as it does a simple get from identity map. Whereas "raise" is more useful for the case that objects are to be detached. As part of this, refactors the strategy initiation logic a bit so that a LoaderStrategy itself knows what "key" was used to create it, thus allowing variants of a single strategy based on what the "lazy" argument is. To achieve this we have to also get rid of _get_strategy_by_cls(). Everything here is internal with the one exception of an apparently undocumented, but not underscored, "strategy_class" key on relationship(). Though it's not clear what "strategy_class" accomplishes; at this point the strategy system is extensible using Property.strategy_for(). Fixes: #3812 Change-Id: I812ad878ea5cf764e15f6f71cb39eee78a645d88
Diffstat (limited to 'test/ext')
-rw-r--r--test/ext/test_baked.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/ext/test_baked.py b/test/ext/test_baked.py
index 4250e363b..2f501eb6c 100644
--- a/test/ext/test_baked.py
+++ b/test/ext/test_baked.py
@@ -576,7 +576,7 @@ class ResultTest(BakedTest):
Address(id=4, email_address='ed@lala.com'),
]),
User(id=9,
- addresses=[Address(id=5)],
+ addresses=[Address(id=5)],
orders=[Order(id=2), Order(id=4)]),
User(id=10, addresses=[])
]
@@ -728,7 +728,6 @@ class LazyLoaderTest(BakedTest):
def test_systemwide_loaders_loadable_via_lazyloader(self):
from sqlalchemy.orm import configure_mappers
- from sqlalchemy.orm.strategies import LazyLoader
baked.bake_lazy_loaders()
try:
@@ -738,7 +737,7 @@ class LazyLoaderTest(BakedTest):
is_(
User.addresses.property.
- _get_strategy_by_cls(LazyLoader).__class__,
+ _get_strategy((('lazy', 'select'), )).__class__,
BakedLazyLoader
)
finally: