class_docstr: Construction of AliasedClauses for the same eager load property but
  different parent mappers, due to inheritance.
class_docstr_tok: ["Construction","of","AliasedClauses","for","the","same","eager","load","property","but","different","parent","mappers",",","due","to","inheritance","."]
code: def test_basic(self):
      (
          Comment,
          Derived,
          derived,
          comments,
          DerivedII,
          Base,
          base,
          derivedII,
      ) = (
          self.classes.Comment,
          self.classes.Derived,
          self.tables.derived,
          self.tables.comments,
          self.classes.DerivedII,
          self.classes.Base,
          self.tables.base,
          self.tables.derivedII,
      )
  
      self.mapper_registry.map_imperatively(Comment, comments)
  
      baseMapper = self.mapper_registry.map_imperatively(
          Base,
          base,
          properties=dict(
              comments=relationship(
                  Comment, lazy="joined", cascade="all, delete-orphan"
              )
          ),
      )
  
      self.mapper_registry.map_imperatively(
          Derived, derived, inherits=baseMapper
      )
  
      self.mapper_registry.map_imperatively(
          DerivedII, derivedII, inherits=baseMapper
      )
  
      sess = fixture_session()
      d = Derived("uid1", "x", "y")
      d.comments = [Comment("uid1", "comment")]
      d2 = DerivedII("uid2", "xx", "z")
      d2.comments = [Comment("uid2", "comment")]
      sess.add_all((d, d2))
      sess.flush()
      sess.expunge_all()
  
      # this eager load sets up an AliasedClauses for the "comment"
      # relationship, then stores it in clauses_by_lead_mapper[mapper for
      # Derived]
      d = sess.get(Derived, "uid1")
      sess.expunge_all()
      assert len([c for c in d.comments]) == 1
  
      # this eager load sets up an AliasedClauses for the "comment"
      # relationship, and should store it in clauses_by_lead_mapper[mapper
      # for DerivedII].  the bug was that the previous AliasedClause create
      # prevented this population from occurring.
      d2 = sess.get(DerivedII, "uid2")
      sess.expunge_all()
  
      # object is not in the session; therefore the lazy load can't trigger
      # here, eager load had to succeed
      assert len([c for c in d2.comments]) == 1
  
imports: import datetime
  import sqlalchemy
  from sqlalchemy import ForeignKey
  from sqlalchemy import Integer
  from sqlalchemy import String
  from sqlalchemy import testing
  from sqlalchemy import text
  from sqlalchemy.orm import backref
  from sqlalchemy.orm import relationship
  from sqlalchemy.orm import Session
  from sqlalchemy.testing import eq_
  from sqlalchemy.testing import fixtures
  from sqlalchemy.testing.fixtures import fixture_session
  from sqlalchemy.testing.schema import Column
  from sqlalchemy.testing.schema import Table
label_desc: Use image node_id 3 for calling the EagerTest5 obj's underlying member method code with example usage: obj.test_basic() without return types