MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_illegal_trackparent

Method test_illegal_trackparent

test/orm/test_attributes.py:653–679  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

651 assert attributes.has_parent(Post, b2, "blog")
652
653 def test_illegal_trackparent(self):
654 class Post:
655 pass
656
657 class Blog:
658 pass
659
660 instrumentation.register_class(Post)
661 instrumentation.register_class(Blog)
662
663 _register_attribute(Post, "blog", useobject=True)
664 assert_raises_message(
665 AssertionError,
666 "This AttributeImpl is not configured to track parents.",
667 attributes.has_parent,
668 Post,
669 Blog(),
670 "blog",
671 )
672 assert_raises_message(
673 AssertionError,
674 "This AttributeImpl is not configured to track parents.",
675 Post.blog.impl.sethasparent,
676 "x",
677 "x",
678 True,
679 )
680
681 def test_inheritance(self):
682 """tests that attributes are polymorphic"""

Callers

nothing calls this directly

Calls 3

assert_raises_messageFunction · 0.90
_register_attributeFunction · 0.70
BlogClass · 0.70

Tested by

no test coverage detected