summaryrefslogtreecommitdiff
path: root/test/orm/test_unitofwork.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/orm/test_unitofwork.py')
-rw-r--r--test/orm/test_unitofwork.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py
index 4b9799d47..386280a50 100644
--- a/test/orm/test_unitofwork.py
+++ b/test/orm/test_unitofwork.py
@@ -849,21 +849,40 @@ class DefaultTest(fixtures.MappedTest):
eq_(h5.foober, 'im the new foober')
@testing.fails_on('firebird', 'Data type unknown on the parameter')
+ @testing.fails_on("oracle+cx_oracle", "seems like a cx_oracle bug")
def test_eager_defaults(self):
hohoval, default_t, Hoho = (self.other.hohoval,
self.tables.default_t,
self.classes.Hoho)
+ Secondary = self.classes.Secondary
+
+ mapper(Hoho, default_t, eager_defaults=True, properties={
+ "sec": relationship(Secondary),
+ "syn": sa.orm.synonym(default_t.c.counter)
+ })
- mapper(Hoho, default_t, eager_defaults=True)
+ mapper(Secondary, self.tables.secondary_table)
h1 = Hoho()
session = create_session()
session.add(h1)
- session.flush()
+
+ if testing.db.dialect.implicit_returning:
+ self.sql_count_(1, session.flush)
+ else:
+ self.sql_count_(2, session.flush)
self.sql_count_(0, lambda: eq_(h1.hoho, hohoval))
+ # no actual eager defaults, make sure error isn't raised
+ h2 = Hoho(hoho=hohoval, counter=5)
+ session.add(h2)
+ session.flush()
+ eq_(h2.hoho, hohoval)
+ eq_(h2.counter, 5)
+
+
def test_insert_nopostfetch(self):
default_t, Hoho = self.tables.default_t, self.classes.Hoho