Skip to content

Commit 6de4fd0

Browse files
author
Luke Bakken
committed
More explicitly check for bare tsqueryresp atom
1 parent 1b9ee6c commit 6de4fd0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

riak/codecs/ttb.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,14 @@ def decode_timeseries(self, resp_ttb, tsobj,
153153

154154
self.maybe_err_ttb(resp_ttb)
155155

156-
resp_a = resp_ttb[0]
157-
156+
# NB: some queries return a BARE 'tsqueryresp' atom
157+
# catch that here:
158158
if resp_ttb == tsqueryresp_a:
159159
return tsobj
160-
elif resp_a == tsputresp_a:
160+
161+
# The response atom is the first element in the response tuple
162+
resp_a = resp_ttb[0]
163+
if resp_a == tsputresp_a:
161164
return
162165
elif resp_a == tsgetresp_a or resp_a == tsqueryresp_a:
163166
resp_data = resp_ttb[1]

riak/tests/test_timeseries_ttb.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22
import datetime
3-
import random
4-
import string
53
import logging
64
import six
75
import unittest
@@ -133,9 +131,7 @@ def setUpClass(cls):
133131
super(TimeseriesTtbTests, cls).setUpClass()
134132

135133
def test_query_that_creates_table_using_interpolation(self):
136-
table = ''.join(
137-
[random.choice(string.ascii_letters + string.digits)
138-
for n in range(32)])
134+
table = self.randname()
139135
query = """CREATE TABLE test-{table} (
140136
geohash varchar not null,
141137
user varchar not null,

0 commit comments

Comments
 (0)