def test_headerfile_write_fail(self):
        subdb = SequenceFileDB(self.dbfile)
        try:
            del subdb.filepath  # remove 'filepath' attribute for test
            db = PrefixUnionDict({'prefix': subdb})

            assert len(db) == 2
            assert 'prefix.seq1' in db

            output = testutil.tempdatafile('prefixUnionDict-write-fail.txt')
            try:
                db.writeHeaderFile(output)
            except AttributeError:
                pass
        finally:
            subdb.close() # closes both db and subdb
Beispiel #2
0
    def test_headerfile_write_fail(self):
        subdb = SequenceFileDB(self.dbfile)
        try:
            del subdb.filepath  # remove 'filepath' attribute for test
            db = PrefixUnionDict({'prefix': subdb})

            assert len(db) == 2
            assert 'prefix.seq1' in db

            output = testutil.tempdatafile('prefixUnionDict-write-fail.txt')
            try:
                db.writeHeaderFile(output)
            except AttributeError:
                pass
        finally:
            subdb.close()  # closes both db and subdb
    def test_headerfile_write(self):
        header = testutil.datafile('prefixUnionDict-2.txt')
        db = PrefixUnionDict(filename=header)
        try:
            assert len(db) == 4
            assert 'a.seq1' in db
            assert 'b.seq1' in db

            output = testutil.tempdatafile('prefixUnionDict-write.txt')
            db.writeHeaderFile(output)
        finally:
            close_pud_dicts(db)

        db2 = PrefixUnionDict(filename=output,
                               trypath=[os.path.dirname(header)])
        try:
            assert len(db2) == 4
            assert 'a.seq1' in db2
            assert 'b.seq1' in db2
        finally:
            close_pud_dicts(db2)
Beispiel #4
0
    def test_headerfile_write(self):
        header = testutil.datafile('prefixUnionDict-2.txt')
        db = PrefixUnionDict(filename=header)
        try:
            assert len(db) == 4
            assert 'a.seq1' in db
            assert 'b.seq1' in db

            output = testutil.tempdatafile('prefixUnionDict-write.txt')
            db.writeHeaderFile(output)
        finally:
            close_pud_dicts(db)

        db2 = PrefixUnionDict(filename=output,
                              trypath=[os.path.dirname(header)])
        try:
            assert len(db2) == 4
            assert 'a.seq1' in db2
            assert 'b.seq1' in db2
        finally:
            close_pud_dicts(db2)