test #7751
(self, decl_base, connection)
| 645 | eq_(e.start, None) |
| 646 | |
| 647 | def test_no_name_declarative(self, decl_base, connection): |
| 648 | """test #7751""" |
| 649 | |
| 650 | class Point: |
| 651 | def __init__(self, x, y): |
| 652 | self.x = x |
| 653 | self.y = y |
| 654 | |
| 655 | def __composite_values__(self): |
| 656 | return self.x, self.y |
| 657 | |
| 658 | def __repr__(self): |
| 659 | return "Point(x=%r, y=%r)" % (self.x, self.y) |
| 660 | |
| 661 | def __eq__(self, other): |
| 662 | return ( |
| 663 | isinstance(other, Point) |
| 664 | and other.x == self.x |
| 665 | and other.y == self.y |
| 666 | ) |
| 667 | |
| 668 | def __ne__(self, other): |
| 669 | return not self.__eq__(other) |
| 670 | |
| 671 | class Vertex(decl_base): |
| 672 | __tablename__ = "vertices" |
| 673 | |
| 674 | id = Column(Integer, primary_key=True) |
| 675 | x1 = Column(Integer) |
| 676 | y1 = Column(Integer) |
| 677 | x2 = Column(Integer) |
| 678 | y2 = Column(Integer) |
| 679 | |
| 680 | start = composite(Point, x1, y1) |
| 681 | end = composite(Point, x2, y2) |
| 682 | |
| 683 | self.assert_compile( |
| 684 | select(Vertex), |
| 685 | "SELECT vertices.id, vertices.x1, vertices.y1, vertices.x2, " |
| 686 | "vertices.y2 FROM vertices", |
| 687 | ) |
| 688 | |
| 689 | decl_base.metadata.create_all(connection) |
| 690 | s = Session(connection) |
| 691 | hv = Vertex(start=Point(1, 2), end=Point(3, 4)) |
| 692 | s.add(hv) |
| 693 | s.commit() |
| 694 | |
| 695 | is_( |
| 696 | hv, |
| 697 | s.scalars( |
| 698 | select(Vertex).where(Vertex.start == Point(1, 2)) |
| 699 | ).first(), |
| 700 | ) |
| 701 | |
| 702 | def test_no_name_declarative_two(self, decl_base, connection): |
| 703 | """test #7752""" |
nothing calls this directly
no test coverage detected