Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DanCech committed Oct 26, 2017
1 parent 78c8066 commit f51e10a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions test_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ def test_merge_empty(self):

whisper.merge(testdb_a, testdb_b)


def test_merge_bad_archive_config(self):
testdb = "test-%s" % self.filename

Expand Down Expand Up @@ -775,15 +774,14 @@ def test_fetch_with_archive_to_select(self):
retention = [(1, 60), (60, 60), (3600, 24), (86400, 365)]
whisper.create(self.filename, retention)

archives = ["1s","1m","1h","1d"]
archives = ["1s", "1m", "1h", "1d"]

for i in range(len(archives)):
fetch = whisper.fetch(self.filename, 0, archiveToSelect=archives[i])
self.assertEqual(fetch[0][2], retention[i][0])

# check time range
self.assertEqual(fetch[0][1] - fetch[0][0],
retention[-1][0] * retention[-1][1])
self.assertEqual(fetch[0][1] - fetch[0][0], retention[-1][0] * retention[-1][1])
with AssertRaisesException(ValueError("Invalid granularity: 2")):
fetch = whisper.fetch(self.filename, 0, archiveToSelect="2s")

Expand Down
6 changes: 3 additions & 3 deletions whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,9 @@ def file_fetch(fh, fromTime, untilTime, now=None, archiveToSelect=None):

diff = now - fromTime

#Parse granularity if requested
# Parse granularity if requested
if archiveToSelect:
retentionStr = str(archiveToSelect)+":1"
retentionStr = str(archiveToSelect) + ":1"
archiveToSelect = parseRetentionDef(retentionStr)[0]

for archive in header['archives']:
Expand All @@ -936,7 +936,7 @@ def file_fetch(fh, fromTime, untilTime, now=None, archiveToSelect=None):
break

if archiveToSelect and not archive:
raise ValueError("Invalid granularity: %s" %(archiveToSelect))
raise ValueError("Invalid granularity: %s" % (archiveToSelect))

return __archive_fetch(fh, archive, fromTime, untilTime)

Expand Down

0 comments on commit f51e10a

Please sign in to comment.