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

Method test_deannotate_clone

test/sql/test_selectable.py:3419–3446  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3417 is_not(b3.right, b4.right)
3418
3419 def test_deannotate_clone(self):
3420 table1 = table("table1", column("col1"), column("col2"))
3421
3422 subq = (
3423 select(table1).where(table1.c.col1 == bindparam("foo")).subquery()
3424 )
3425 stmt = select(subq)
3426
3427 s2 = sql_util._deep_annotate(stmt, {"_orm_adapt": True})
3428 s3 = sql_util._deep_deannotate(s2)
3429 s4 = sql_util._deep_deannotate(s3)
3430
3431 eq_(stmt._annotations, {})
3432 eq_(subq._annotations, {})
3433
3434 eq_(s2._annotations, {"_orm_adapt": True})
3435 eq_(s3._annotations, {})
3436 eq_(s4._annotations, {})
3437
3438 # select._raw_columns[0] is the subq object
3439 eq_(s2._raw_columns[0]._annotations, {"_orm_adapt": True})
3440 eq_(s3._raw_columns[0]._annotations, {})
3441 eq_(s4._raw_columns[0]._annotations, {})
3442
3443 is_not(s3, s2)
3444 is_not(s4, s3) # deep deannotate makes a clone unconditionally
3445
3446 is_(s3._deannotate(), s3) # regular deannotate returns same object
3447
3448 def test_annotate_unique_traversal(self):
3449 """test that items are copied only once during

Callers

nothing calls this directly

Calls 10

tableFunction · 0.90
columnFunction · 0.90
selectFunction · 0.90
bindparamFunction · 0.90
eq_Function · 0.90
is_notFunction · 0.90
is_Function · 0.90
subqueryMethod · 0.45
whereMethod · 0.45
_deannotateMethod · 0.45

Tested by

no test coverage detected