(self)
| 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""" |
nothing calls this directly
no test coverage detected