title: InvalidRequestError: Instance '<User at 0x7f65938a7510>' is not persisted
body: <p>I want to perform such a test in the framework Flask and gets the message:</p>
  
  <pre><code>InvalidRequestError: Instance '&lt;User at 0x7f65938a7510&gt;' is not persisted
  
    File "tests.py", line 31, in test_removeProfil
      db.session.delete(user)
  </code></pre>
  
  <p>My test code:</p>
  
  <pre><code>class TestCase(unittest.TestCase):
  
      def test_removeProfil(self):
          user = User(name="John", age=33, email="john@john.com")
          db.session.delete(user)
          db.session.commit()
          self.assertNotEqual(user.name, "John")
          self.assertNotEqual(user.age, 33)
          self.assertNotEqual(user.email, "john@john.com")
  </code></pre>