(self)
| 814 | class ToMetaDataTest(fixtures.TestBase, AssertsCompiledSQL, ComparesTables): |
| 815 | |
| 816 | def test_defaults_are_copied(self): |
| 817 | table = Table( |
| 818 | "t", |
| 819 | MetaData(), |
| 820 | Column( |
| 821 | "x", |
| 822 | Integer, |
| 823 | default=1, |
| 824 | onupdate=2, |
| 825 | server_default="3", |
| 826 | server_onupdate="4", |
| 827 | ), |
| 828 | ) |
| 829 | |
| 830 | copied = table.to_metadata(MetaData()) |
| 831 | |
| 832 | is_not_(table.c.x.default, copied.c.x.default) |
| 833 | is_(table.c.x.default.column, table.c.x) |
| 834 | is_(copied.c.x.default.column, copied.c.x) |
| 835 | is_not_(table.c.x.onupdate, copied.c.x.onupdate) |
| 836 | is_(table.c.x.onupdate.column, table.c.x) |
| 837 | is_(copied.c.x.onupdate.column, copied.c.x) |
| 838 | is_not_(table.c.x.server_default, copied.c.x.server_default) |
| 839 | is_(table.c.x.server_default.column, table.c.x) |
| 840 | is_(copied.c.x.server_default.column, copied.c.x) |
| 841 | is_not_(table.c.x.server_onupdate, copied.c.x.server_onupdate) |
| 842 | is_(table.c.x.server_onupdate.column, table.c.x) |
| 843 | is_(copied.c.x.server_onupdate.column, copied.c.x) |
| 844 | |
| 845 | def test_callable_and_expression_defaults_are_copied(self): |
| 846 | def default_value(): |
nothing calls this directly
no test coverage detected