MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_one

Method test_one

test/orm/test_assorted_eager.py:860–922  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

858 pass
859
860 def test_one(self):
861 (
862 Part,
863 inherited_part,
864 design_types,
865 DesignType,
866 parts,
867 design,
868 Design,
869 InheritedPart,
870 ) = (
871 self.classes.Part,
872 self.tables.inherited_part,
873 self.tables.design_types,
874 self.classes.DesignType,
875 self.tables.parts,
876 self.tables.design,
877 self.classes.Design,
878 self.classes.InheritedPart,
879 )
880
881 p_m = self.mapper_registry.map_imperatively(Part, parts)
882
883 self.mapper_registry.map_imperatively(
884 InheritedPart,
885 inherited_part,
886 properties=dict(part=relationship(Part, lazy="joined")),
887 )
888
889 d_m = self.mapper_registry.map_imperatively(
890 Design,
891 design,
892 properties=dict(
893 inheritedParts=relationship(
894 InheritedPart,
895 cascade="all, delete-orphan",
896 backref="design",
897 )
898 ),
899 )
900
901 self.mapper_registry.map_imperatively(DesignType, design_types)
902
903 d_m.add_property(
904 "type", relationship(DesignType, lazy="joined", backref="designs")
905 )
906
907 p_m.add_property(
908 "design",
909 relationship(
910 Design,
911 lazy="joined",
912 backref=backref("parts", cascade="all, delete-orphan"),
913 ),
914 )
915
916 d = Design()
917 sess = fixture_session()

Callers

nothing calls this directly

Calls 10

relationshipFunction · 0.90
backrefFunction · 0.90
fixture_sessionFunction · 0.90
DesignClass · 0.85
map_imperativelyMethod · 0.80
add_propertyMethod · 0.80
addMethod · 0.45
flushMethod · 0.45
expunge_allMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected