Last active
November 15, 2019 22:13
-
-
Save 4OH4/192ea072cbb5f0899e628204b5aa1fdf to your computer and use it in GitHub Desktop.
Doctest case embedded in the class documentation for a DAO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sqlite3 | |
class DAO(object): | |
""" | |
SQLite3 Data Access Object | |
Usage: | |
>>> dao = DAO('example.db') | |
Database connection initialised | |
""" | |
def __init__(self, db_filepath='example.db'): | |
"""Initialize DB class variables""" | |
self.connection = sqlite3.connect(db_filepath) | |
print('Database connection initialised') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment