title: Python unit tests: type checking custom class type
body: <p>I'm writing unit tests as I develop a program. I'm using SQLAlchemy for database processes, so I have a few functions like this:</p>
  
  <pre><code>def create_sqla_engine():
      """ Create and return the SQLA engine """
      mysql_uri = os.environ.get('MYSQL_CONNECTION_URI')
      engine = sqlalchemy.create_engine(mysql_uri)
      return engine
  </code></pre>
  
  <p>If I do <code>print(type(engine))</code> I can see that the type is <code>&lt;class 'sqlalchemy.engine.base.Engine'&gt;</code></p>
  
  <p>...so I want to test if this function works by checking if the type is correct (assuming the type will be <code>None</code> if the <code>create_engine</code> call fails...)</p>
  
  <p>This code is in <code>unittests.py</code>:</p>
  
  <pre><code>class TestDatabase(unittest.TestCase):
  
  
      def test_database_create_merkle_sqla_session(self):
          assert type(myprogram_database.create_sqla_engine()) is # ?
  </code></pre>
  
  <p>How do I check the type of a variable that is a <code>class</code>?</p>