def test_file_diff_invalid(self): testdb = "test-%s" % self.filename whisper.create(testdb, [(120, 10)]) whisper.create(self.filename, self.retention) # Merging 2 archives with different retentions should fail with open(testdb, 'rb') as fh_1: with open(self.filename, 'rb+') as fh_2: with AssertRaisesException(NotImplementedError('test-db.wsp and db.wsp archive configurations are unalike. Resize the input before diffing')): whisper.file_diff(fh_1, fh_2) self._remove(testdb)
def test_file_diff(self): testdb = "test-%s" % self.filename now = time.time() whisper.create(testdb, self.retention) whisper.create(self.filename, self.retention) whisper.update(testdb, 1.0, now) whisper.update(self.filename, 2.0, now) # Merging 2 archives with different retentions should fail with open(testdb, 'rb') as fh_1: with open(self.filename, 'rb+') as fh_2: results = whisper.file_diff(fh_1, fh_2) self._remove(testdb) expected = [(0, [(int(now), 1.0, 2.0)], 1), (1, [], 0)] self.assertEqual(results, expected)