class_docstr: deals with inheritance and many-to-many relationships
class_docstr_tok: ["deals","with","inheritance","and","many-to-many","relationships"]
code: def test_basic(self):
      class Foo:
          def __init__(self, data=None):
              self.data = data
  
      self.mapper_registry.map_imperatively(Foo, foo)
  
      class Bar(Foo):
          pass
  
      self.mapper_registry.map_imperatively(
          Bar,
          bar,
          inherits=Foo,
          properties={
              "foos": relationship(
                  Foo, secondary=foo_bar, lazy="joined"
              )
          },
      )
  
      sess = fixture_session()
      b = Bar("barfoo")
      sess.add(b)
      sess.flush()
  
      f1 = Foo("subfoo1")
      f2 = Foo("subfoo2")
      b.foos.append(f1)
      b.foos.append(f2)
  
      sess.flush()
      sess.expunge_all()
  
      result = sess.query(Bar).all()
      print(result[0])
      print(result[0].foos)
      self.assert_unordered_result(
          result,
          Bar,
          {
              "id": b.id,
              "data": "barfoo",
              "foos": (
                  Foo,
                  [
                      {"id": f1.id, "data": "subfoo1"},
                      {"id": f2.id, "data": "subfoo2"},
                  ],
              ),
          },
      )
  
imports: from sqlalchemy import Column
  from sqlalchemy import ForeignKey
  from sqlalchemy import Integer
  from sqlalchemy import Sequence
  from sqlalchemy import String
  from sqlalchemy import Table
  from sqlalchemy.orm import class_mapper
  from sqlalchemy.orm import relationship
  from sqlalchemy.testing import config
  from sqlalchemy.testing import eq_
  from sqlalchemy.testing import fixtures
  from sqlalchemy.testing.fixtures import fixture_session
  from sqlalchemy.testing.provision import normalize_sequence
label_desc: Use image node_id 3 for calling the InheritTest2 obj's underlying member method code with example usage: obj.test_basic() without return types