MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_deannotate_clone

Method test_deannotate_clone

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

Source from the content-addressed store, hash-verified

3404 is_not(b3.right, b4.right)
3405
3406 def test_deannotate_clone(self):
3407 table1 = table("table1", column("col1"), column("col2"))
3408
3409 subq = (
3410 select(table1).where(table1.c.col1 == bindparam("foo")).subquery()
3411 )
3412 stmt = select(subq)
3413
3414 s2 = sql_util._deep_annotate(stmt, {"_orm_adapt": True})
3415 s3 = sql_util._deep_deannotate(s2)
3416 s4 = sql_util._deep_deannotate(s3)
3417
3418 eq_(stmt._annotations, {})
3419 eq_(subq._annotations, {})
3420
3421 eq_(s2._annotations, {"_orm_adapt": True})
3422 eq_(s3._annotations, {})
3423 eq_(s4._annotations, {})
3424
3425 # select._raw_columns[0] is the subq object
3426 eq_(s2._raw_columns[0]._annotations, {"_orm_adapt": True})
3427 eq_(s3._raw_columns[0]._annotations, {})
3428 eq_(s4._raw_columns[0]._annotations, {})
3429
3430 is_not(s3, s2)
3431 is_not(s4, s3) # deep deannotate makes a clone unconditionally
3432
3433 is_(s3._deannotate(), s3) # regular deannotate returns same object
3434
3435 def test_annotate_unique_traversal(self):
3436 """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