Example #1
0
def test_delete(mock_db, db_format, db_compression):
    db_path = mock_db(db_format, db_compression)

    db.write(db_path, range(1, 9))

    assert list(db.read(db_path)) == [1, 2, 3, 4, 5, 6, 7, 8]

    db.delete(db_path, lambda x: x == 4)

    assert list(db.read(db_path)) == [1, 2, 3, 5, 6, 7, 8]
Example #2
0
def test_delete(mock_db, db_format, db_compression):
    db_path = mock_db(db_format, db_compression)

    db.write(db_path, range(1, 9))

    assert list(db.read(db_path)) == [1, 2, 3, 4, 5, 6, 7, 8]

    db.delete(db_path, lambda x: x == 4)

    assert list(db.read(db_path)) == [1, 2, 3, 5, 6, 7, 8]
Example #3
0
def download_modified_revisions():
    try:
        last_modified = db.last_modified(REVISIONS_DB)
    except LastModifiedNotAvailable:
        return

    modified_revisions = get(modified_start=last_modified)
    modified_revision_ids = set(rev["id"] for rev in modified_revisions)

    db.delete(REVISIONS_DB,
              lambda revision: revision["id"] in modified_revision_ids)

    db.append(REVISIONS_DB, modified_revisions)
Example #4
0
def test_delete_compressed(tmp_path):
    db_path = tmp_path / 'prova.json.gz'

    print(db_path)

    db.register(db_path, 'https://alink', 1)

    db.write(db_path, range(1, 9))

    assert list(db.read(db_path)) == [1, 2, 3, 4, 5, 6, 7, 8]

    db.delete(db_path, lambda x: x == 4)

    assert list(db.read(db_path)) == [1, 2, 3, 5, 6, 7, 8]
Example #5
0
def delete_bugs(match):
    db.delete(BUGS_DB, match)
Example #6
0
def delete_issues(match: Callable[[IssueDict], bool]) -> None:
    db.delete(GITHUB_ISSUES_DB, match)
Example #7
0
def delete_bugs(bug_ids):
    db.delete(BUGS_DB, lambda bug: bug["id"] in set(bug_ids))
Example #8
0
def delete_bugs(bug_ids):
    db.delete(BUGS_DB, lambda bug: bug["id"] in set(bug_ids))
Example #9
0
 def delete_issues(self, match: Callable[[IssueDict], bool]) -> None:
     db.delete(self.db_path, match)
Example #10
0
def test_delete_not_existent(mock_db):
    db_path = mock_db("json", None)
    assert not os.path.exists(db_path)
    db.delete(db_path, lambda x: x == 4)
    assert not os.path.exists(db_path)