diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-20 14:52:21 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-20 14:52:21 -0500 |
commit | 5c611f702cf1df6e072ddf17040c20e3a5fb96de (patch) | |
tree | 66a0dec56a12828791ba8ffedbf78f5ce2f75d8e /test/orm/inheritance/test_basic.py | |
parent | 9ed764650ccad83bbc03668e9b4f2fd88b328395 (diff) | |
download | sqlalchemy-5c611f702cf1df6e072ddf17040c20e3a5fb96de.tar.gz |
- the in-flush check for "pending orphan being flushed" has been removed.
It's now possible to issue INSERT for an object that would otherwise
be an orphan due to no parent object specified, along a relationship
that specifies "delete-orphan" cascade. The detection of this condition
as an error should now be accomplished via NOT NULL foreign keys.
[ticket:1912]
Diffstat (limited to 'test/orm/inheritance/test_basic.py')
-rw-r--r-- | test/orm/inheritance/test_basic.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index b9956f286..3e4d50d96 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -1276,6 +1276,15 @@ class PKDiscriminatorTest(_base.MappedTest): class DeleteOrphanTest(_base.MappedTest): + """Test the fairly obvious, that an error is raised + when attempting to insert an orphan. + + Previous SQLA versions would check this constraint + in memory which is the original rationale for this test. + + """ + + @classmethod def define_tables(cls, metadata): global single, parent @@ -1310,8 +1319,6 @@ class DeleteOrphanTest(_base.MappedTest): sess = create_session() s1 = SubClass(data='s1') sess.add(s1) - assert_raises_message(orm_exc.FlushError, - r"is not attached to any parent 'Parent' instance via " - "that classes' 'related' attribute", sess.flush) + assert_raises(sa_exc.DBAPIError, sess.flush) |