def METHOD_NAME(self):
    sess = fixture_session()
    pa = with_polymorphic(Person, [Engineer])
    pa_alias = with_polymorphic(Person, [Engineer], aliased=True)
    eq_(
        [
            row
            for row in sess.query(
                pa.name,
                pa.Engineer.primary_language,
                pa_alias.name,
                pa_alias.Engineer.primary_language,
            )
            .join(
                pa_alias,
                or_(
                    pa.Engineer.primary_language
                    == pa_alias.Engineer.primary_language,
                    and_(
                        pa.Engineer.primary_language == None,  # noqa
                        pa_alias.Engineer.primary_language == None,
                        pa.person_id > pa_alias.person_id,
                    ),
                ),
            )
            .order_by(pa.name, pa_alias.name)
        ],
        [
            ("dilbert", "java", "dilbert", "java"),
            ("dogbert", None, "pointy haired boss", None),
            ("vlad", "cobol", "vlad", "cobol"),
            ("wally", "c++", "wally", "c++"),
        ],
    )