Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
    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"
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
 def setUpClass(cls):
     cls.con = sqlite.connect(localdb)
     cls.cur = cls.con.cursor()
     cls.cur.close()
Exemplo n.º 6
0
 def setUpClass(cls):
     cls.con = sqlite.connect(localdb)
Exemplo n.º 7
0
 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")
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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")
Exemplo n.º 10
0
 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")