def test_m2m(self):
        person_table = Table('person', metadata,
            Column('id', Integer, primary_key=True),
            Column('name', String(32)))

        category_table = Table('category', metadata,
            Column('name', String(30), primary_key=True))

        person_category_table = Table('person_category', metadata,
            Column('person_id', Integer, ForeignKey('person.id')),
            Column('category_name', String(30), ForeignKey('category.name')))

        metadata.create_all()
        metadata.clear()

        class Person(Entity):
            categories = ManyToMany('Category',
                                    tablename='person_category')

        class Category(Entity):
            persons = ManyToMany('Person',
                                 tablename='person_category')

        setup_all()

        stupid = Category(name="Stupid")
        simpson = Category(name="Simpson")
        old = Category(name="Old")

        grampa = Person(name="Abe", categories=[simpson, old])
        homer = Person(name="Homer", categories=[simpson, stupid])
        bart = Person(name="Bart")
        lisa = Person(name="Lisa")

        simpson.persons.extend([bart, lisa])

        session.commit()
        session.expunge_all()

        c = Category.get_by(name="Simpson")
        grampa = Person.get_by(name="Abe")

        assert len(c.persons) == 4
        assert grampa.categories in c

     # currently fails. See elixir/relationships.py:_get_join_clauses
#    def test_m2m_extra_fk(self):
#        person_table = Table('person', metadata,
#            Column('id', Integer, primary_key=True),
#            Column('name', String(32), unique=True))
#
#        category_table = Table('category', metadata,
#            Column('name', String(30), primary_key=True))
#
#        person_category_table = Table('person_category', metadata,
#            Column('person_id', Integer, ForeignKey('person.id')),
#            Column('category_name', String(30), ForeignKey('category.name')),
#            Column('person_name', String(32), ForeignKey('person.name')))
#
#        metadata.create_all()
#        metadata.clear()
#
#        class Person(Entity):
#            categories = ManyToMany('Category',
#                                    tablename='person_category',
#                                    local_colname='person_id')
#
#        class Category(Entity):
#            persons = ManyToMany('Person',
#                                 tablename='person_category')
#
#        setup_all()
#
#        stupid = Category(name="Stupid")
#        simpson = Category(name="Simpson")
#        old = Category(name="Old")
#
#        grampa = Person(name="Abe", categories=[simpson, old])
#        homer = Person(name="Homer", categories=[simpson, stupid])
#        bart = Person(name="Bart")
#        lisa = Person(name="Lisa")
#
#        simpson.persons.extend([bart, lisa])
#
#        session.commit()
#        session.expunge_all()
#
#        c = Category.get_by(name="Simpson")
#        grampa = Person.get_by(name="Abe")
#
#        assert len(c.persons) == 4
#        assert c in grampa.categories
dataset/ETHPy150Open jmg/elixir/tests/test_autoload.py/TestAutoload.test_m2m/swapped operands of `in`