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

Method copy_fixture

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

Source from the content-addressed store, hash-verified

951
952 @testing.fixture
953 def copy_fixture(self, metadata):
954 from sqlalchemy.testing.schema import Table
955
956 table = Table(
957 "mytable",
958 metadata,
959 Column("myid", Integer, Sequence("foo_id_seq"), primary_key=True),
960 Column("name", String(40), nullable=True),
961 Column("status", Boolean(create_constraint=True)),
962 Column(
963 "entry",
964 Enum(
965 "one",
966 "two",
967 "three",
968 name="entry_enum",
969 create_constraint=True,
970 ),
971 ),
972 Column(
973 "foo",
974 String(40),
975 nullable=False,
976 server_default="x",
977 server_onupdate="q",
978 ),
979 Column(
980 "bar", String(40), nullable=False, default="y", onupdate="z"
981 ),
982 Column(
983 "description", String(30), CheckConstraint("description='hi'")
984 ),
985 UniqueConstraint("name"),
986 test_needs_fk=True,
987 )
988
989 table2 = Table(
990 "othertable",
991 metadata,
992 Column("id", Integer, Sequence("foo_seq"), primary_key=True),
993 Column("myid", Integer, ForeignKey("mytable.myid")),
994 test_needs_fk=True,
995 )
996
997 table3 = Table(
998 "has_comments",
999 metadata,
1000 Column("foo", Integer, comment="some column"),
1001 comment="table comment",
1002 )
1003
1004 metadata.create_all(testing.db)
1005
1006 return table, table2, table3
1007
1008 @testing.fixture(
1009 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