def test_CheckFailedOpen(self): YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" try: con = sqlite.connect(YOU_CANNOT_OPEN_THIS) except sqlite.OperationalError: return self.fail("should have raised an OperationalError")
def setUpClass(cls): cls.con = sqlite.connect(localDB) cls.cur = cls.con.cursor() if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test") try: del sqlite.adapters[int] except: pass sqlite.register_adapter(int, ObjectAdaptationTests.cast)
def setUpClass(cls): cls.con = sqlite.connect(localDB, detect_types=sqlite.PARSE_COLNAMES) cls.cur = cls.con.cursor() if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test") sqlite.converters["FOO"] = lambda x: "[%s]" % x.decode("ascii") sqlite.converters["BAR"] = lambda x: "<%s>" % x.decode("ascii") sqlite.converters["EXC"] = lambda x: 5 / 0 sqlite.converters["B1B1"] = lambda x: "MARKER"
def setUpClass(cls): cls.con = sqlite.connect(localDB, detect_types=sqlite.PARSE_DECLTYPES) cls.cur = cls.con.cursor() if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test") # override float, make them always return the same number sqlite.converters["FLOAT"] = lambda x: 47.2 # and implement two custom ones sqlite.converters["BOOL"] = lambda x: bool(int(x)) sqlite.converters["FOO"] = DeclTypesTests.Foo sqlite.converters["WRONG"] = lambda x: "WRONG" sqlite.converters["NUMBER"] = float
def setUpClass(cls): cls.con = sqlite.connect(localdb) cls.cur = cls.con.cursor() cls.cur.close()
def setUpClass(cls): cls.con = sqlite.connect(localdb)
def setUpClass(cls): cls.con = sqlite.connect(localDB, detect_types=sqlite.PARSE_DECLTYPES) cls.cur = cls.con.cursor() if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test")
def setUpClass(cls): cls.con = sqlite.connect(localDB, detect_types=sqlite.PARSE_COLNAMES) if cls.con.execute("pragma table_info(test)").fetchall(): cls.con.execute("drop table test") sqlite.register_converter("bin", BinaryConverterTests.convert)
def setUpClass(cls): cls.con = sqlite.connect(localDB) cls.cur = cls.con.cursor() if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test")
def setUpClass(cls): cls.con = sqlite.connect(localDB) cls.cur = cls.con.cursor() cls.cur.execute("create table if not exists test(x integer)") if cls.cur.execute("pragma table_info(test)").fetchall(): cls.cur.execute("drop table test")