MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _fixture

Method _fixture

test/ext/test_hybrid.py:1184–1211  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1182 __dialect__ = "default"
1183
1184 def _fixture(self):
1185 Base = declarative_base()
1186
1187 class A(Base):
1188 __tablename__ = "a"
1189 id = Column(Integer, primary_key=True)
1190 _value = Column("value", String)
1191
1192 @hybrid.hybrid_method
1193 def value(self, x):
1194 "This is an instance-level docstring"
1195 return int(self._value) + x
1196
1197 @value.expression
1198 def value(cls, value):
1199 "This is a class-level docstring"
1200 return func.foo(cls._value, value) + value
1201
1202 @hybrid.hybrid_method
1203 def other_value(self, x):
1204 "This is an instance-level docstring"
1205 return int(self._value) + x
1206
1207 @other_value.expression
1208 def other_value(cls, value):
1209 return func.foo(cls._value, value) + value
1210
1211 return A
1212
1213 def test_call(self):
1214 A = self._fixture()

Callers 9

test_callMethod · 0.95
test_expressionMethod · 0.95
test_infoMethod · 0.95
test_queryMethod · 0.95
test_aliased_queryMethod · 0.95
test_query_colMethod · 0.95
test_docstringMethod · 0.95

Calls 1

declarative_baseFunction · 0.90

Tested by

no test coverage detected