MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / copy_fixture

Method copy_fixture

test/sql/test_metadata.py:888–941  ·  view source on GitHub ↗
(self, metadata)

Source from the content-addressed store, hash-verified

886
887 @testing.fixture
888 def copy_fixture(self, metadata):
889 from sqlalchemy.testing.schema import Table
890
891 table = Table(
892 "mytable",
893 metadata,
894 Column("myid", Integer, Sequence("foo_id_seq"), primary_key=True),
895 Column("name", String(40), nullable=True),
896 Column("status", Boolean(create_constraint=True)),
897 Column(
898 "entry",
899 Enum(
900 "one",
901 "two",
902 "three",
903 name="entry_enum",
904 create_constraint=True,
905 ),
906 ),
907 Column(
908 "foo",
909 String(40),
910 nullable=False,
911 server_default="x",
912 server_onupdate="q",
913 ),
914 Column(
915 "bar", String(40), nullable=False, default="y", onupdate="z"
916 ),
917 Column(
918 "description", String(30), CheckConstraint("description='hi'")
919 ),
920 UniqueConstraint("name"),
921 test_needs_fk=True,
922 )
923
924 table2 = Table(
925 "othertable",
926 metadata,
927 Column("id", Integer, Sequence("foo_seq"), primary_key=True),
928 Column("myid", Integer, ForeignKey("mytable.myid")),
929 test_needs_fk=True,
930 )
931
932 table3 = Table(
933 "has_comments",
934 metadata,
935 Column("foo", Integer, comment="some column"),
936 comment="table comment",
937 )
938
939 metadata.create_all(testing.db)
940
941 return table, table2, table3
942
943 @testing.fixture(
944 params=[

Callers

nothing calls this directly

Calls 10

TableClass · 0.90
ColumnClass · 0.90
SequenceClass · 0.90
StringClass · 0.90
BooleanClass · 0.90
EnumClass · 0.90
CheckConstraintClass · 0.90
UniqueConstraintClass · 0.90
ForeignKeyClass · 0.90
create_allMethod · 0.80

Tested by

no test coverage detected