(self)
| 316 | ) |
| 317 | |
| 318 | def test_hybrid_descriptor_two(self): |
| 319 | class Point: |
| 320 | def __init__(self, x, y): |
| 321 | self.x, self.y = x, y |
| 322 | |
| 323 | @hybrid_property |
| 324 | def double_x(self): |
| 325 | return self.x * 2 |
| 326 | |
| 327 | self._fixture(Point) |
| 328 | alias = aliased(Point) |
| 329 | |
| 330 | eq_(str(Point.double_x), "Point.double_x") |
| 331 | eq_(str(alias.double_x), "aliased(Point).double_x") |
| 332 | eq_(str(Point.double_x.__clause_element__()), "point.x * :x_1") |
| 333 | eq_(str(alias.double_x.__clause_element__()), "point_1.x * :x_1") |
| 334 | |
| 335 | sess = fixture_session() |
| 336 | |
| 337 | self.assert_compile( |
| 338 | sess.query(alias).filter(alias.double_x > Point.x), |
| 339 | "SELECT point_1.id AS point_1_id, point_1.x AS point_1_x, " |
| 340 | "point_1.y AS point_1_y FROM point AS point_1, point " |
| 341 | "WHERE point_1.x * :x_1 > point.x", |
| 342 | ) |
| 343 | |
| 344 | def test_hybrid_descriptor_three(self): |
| 345 | class Point: |
nothing calls this directly
no test coverage detected