Exemplo n.º 1
0
class DatabaseTests:
  def __init__(self):
    db = "test.db"
    os.remove(db)
    self.__db = Database(db)
    self.__db.load()

    failures = 0
    try:
      self.__db.add_user("jrenggli", "*****@*****.**", 42)
      self.__db.add_user("yschaerli", "*****@*****.**", 8383)
      self.__db.add_user("jreNggli", "*****@*****.**", 28482)
    except sqlite3.IntegrityError:
      assert(False)
    except Exception:
      failures += 1
    finally:
      assert(failures == 1)

    src = None
    try:
      src = self.__db.add_source("RCSB", "text/pdb", "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId={0}", "RCSB Protein Data Bank")
    except sqlite3.IntegrityError, e:
      assert(False)
    except Exception, e:
      failures += 1
      assert(False)
Exemplo n.º 2
0
class DatabaseTests:
    def __init__(self):
        db = "test.db"
        os.remove(db)
        self.__db = Database(db)
        self.__db.load()

        failures = 0
        try:
            self.__db.add_user("jrenggli", "*****@*****.**", 42)
            self.__db.add_user("yschaerli", "*****@*****.**", 8383)
            self.__db.add_user("jreNggli", "*****@*****.**", 28482)
        except sqlite3.IntegrityError:
            assert (False)
        except Exception:
            failures += 1
        finally:
            assert (failures == 1)

        src = None
        try:
            src = self.__db.add_source(
                "RCSB", "text/pdb",
                "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId={0}",
                "RCSB Protein Data Bank")
        except sqlite3.IntegrityError, e:
            assert (False)
        except Exception, e:
            failures += 1
            assert (False)
Exemplo n.º 3
0
#! /usr/bin/python3

from database.database import Database

if __name__ == "__main__":
    db = Database()
    db.load()
    db.add_source(
        "RCSB", "pdb",
        "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId={0}",
        "RCSB Protein Data Bank")
    #    db.add_source("raspbian", "pdb", "http://192.168.2.128:8080/static/{0}.pdb", "Local test host")
    #db.add_user("jrenggli", "*****@*****.**", 42)

    source = db.find_source("rcsb", "pdb")
    #source = db.find_source("raspbian", "pdb")
    if not source:
        raise Exception("Source not found!")
    proteins = ["2KXR"]  #,  "3M3N"]
    for name in proteins:
        protein = db.get_protein_info(source, name)
        if not protein:
            raise Exception("Protein not found!")
        for mid in protein.get_models():
            model = db.load_model(protein, mid)
            print(len(model.getvalue()))
    print("main")
Exemplo n.º 4
0
#! /usr/bin/python3

from database.database import Database

if __name__ == "__main__":
    db = Database()
    db.load()
    db.add_source("RCSB", "pdb",
      "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId={0}",
      "RCSB Protein Data Bank")
#    db.add_source("raspbian", "pdb", "http://192.168.2.128:8080/static/{0}.pdb", "Local test host")
    #db.add_user("jrenggli", "*****@*****.**", 42)
    
    source = db.find_source("rcsb", "pdb")
    #source = db.find_source("raspbian", "pdb")
    if not source:
      raise Exception("Source not found!")
    proteins = ["2KXR"]#,  "3M3N"]
    for name in proteins:
      protein = db.get_protein_info(source,  name)
      if not protein:
        raise Exception("Protein not found!")
      for mid in protein.get_models():
        model = db.load_model(protein, mid)
        print(len(model.getvalue()))
    print("main")