(self)
| 342 | ) |
| 343 | |
| 344 | def test_hybrid_descriptor_three(self): |
| 345 | class Point: |
| 346 | def __init__(self, x, y): |
| 347 | self.x, self.y = x, y |
| 348 | |
| 349 | @hybrid_property |
| 350 | def x_alone(self): |
| 351 | return self.x |
| 352 | |
| 353 | self._fixture(Point) |
| 354 | alias = aliased(Point) |
| 355 | |
| 356 | eq_(str(Point.x_alone), "Point.x_alone") |
| 357 | eq_(str(alias.x_alone), "aliased(Point).x_alone") |
| 358 | |
| 359 | # from __clause_element__() perspective, Point.x_alone |
| 360 | # and Point.x return the same thing, so that's good |
| 361 | eq_(str(Point.x.__clause_element__()), "point.x") |
| 362 | eq_(str(Point.x_alone.__clause_element__()), "point.x") |
| 363 | |
| 364 | # same for the alias |
| 365 | eq_(str(alias.x + 1), "point_1.x + :x_1") |
| 366 | eq_(str(alias.x_alone + 1), "point_1.x + :x_1") |
| 367 | |
| 368 | point_mapper = inspect(Point) |
| 369 | |
| 370 | eq_( |
| 371 | Point.x_alone._annotations, |
| 372 | { |
| 373 | "entity_namespace": point_mapper, |
| 374 | "parententity": point_mapper, |
| 375 | "parentmapper": point_mapper, |
| 376 | "proxy_key": "x_alone", |
| 377 | "proxy_owner": point_mapper, |
| 378 | }, |
| 379 | ) |
| 380 | eq_( |
| 381 | Point.x._annotations, |
| 382 | { |
| 383 | "entity_namespace": point_mapper, |
| 384 | "parententity": point_mapper, |
| 385 | "parentmapper": point_mapper, |
| 386 | "proxy_key": "x", |
| 387 | "proxy_owner": point_mapper, |
| 388 | }, |
| 389 | ) |
| 390 | |
| 391 | eq_(str(alias.x_alone == alias.x), "point_1.x = point_1.x") |
| 392 | |
| 393 | a2 = aliased(Point) |
| 394 | eq_(str(a2.x_alone == alias.x), "point_1.x = point_2.x") |
| 395 | |
| 396 | eq_( |
| 397 | a2.x._annotations, |
| 398 | { |
| 399 | "entity_namespace": inspect(a2), |
| 400 | "parententity": inspect(a2), |
| 401 | "parentmapper": point_mapper, |
nothing calls this directly
no test coverage detected