title: Python doctest: how to testing a database insert or delete function?
body: <p>The question is simple, the answer I dont know...</p>
  
  <p>I'm newbie with testing and I have problems testing class for drive a sql3 database. What is the best way for test a class like this? Test the class or test the <strong>init</strong> function is not a problem, but the others? the test insert a test row?</p>
  
  <pre><code>import sqlite3
  
  
  class DataBase:
      def __init__(self):
          self._database_path = 'data.sql'
          self._conn = sqlite3.connect(self._database_path)
          self._cursor = self._conn.cursor()
  
      def get(self, sql):
          # select
          self._cursor.execute(sql)
          dataset = []
          for row in self._cursor:
              dataset.append(row)
  
          return dataset
  
     def post(self, sql):
         # insert
         self._cursor.execute(sql)
         self._conn.commit()
  </code></pre>
  
  <p>Thank you for all of you, thank you for all your answers!!</p>