Skip to content

Commit 11f8da8

Browse files
author
Richard Bounds
committed
Fix for Python 3.4 compatibility
Add test for multiple reading audit log for multiple symbols
1 parent a6e7008 commit 11f8da8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

arctic/store/version_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def read_audit_log(self, symbol=None, message=None):
208208
"""
209209
query = {}
210210
if symbol:
211-
if isinstance(symbol, basestring):
211+
if isinstance(symbol, six.string_types):
212212
query['symbol'] = {'$regex': symbol}
213213
else:
214214
query['symbol'] = {'$in': list(symbol)}

tests/integration/store/test_version_store_audit.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
symbol = 'TS1'
4343
symbol2 = 'TS2'
44+
symbol3 = 'TS3'
4445

4546

4647
def test_ArcticTransaction_can_do_first_writes(library):
@@ -121,6 +122,9 @@ def test_metadata_changes_writes(library):
121122

122123

123124
def test_audit_read(library):
125+
with ArcticTransaction(library, symbol3, 'u3', 'foo') as mt:
126+
mt.write(symbol3, ts1)
127+
124128
with ArcticTransaction(library, symbol, 'u1', 'l1') as mt:
125129
mt.write(symbol, ts1)
126130

@@ -142,6 +146,14 @@ def test_audit_read(library):
142146
assert symbol_audit_log == [{u'new_v': 2, u'symbol': u'TS1', u'message': u'l2', u'user': u'u2', u'orig_v': 1},
143147
{u'new_v': 1, u'symbol': u'TS1', u'message': u'l1', u'user': u'u1', u'orig_v': 0}]
144148

149+
150+
symbols_audit_log = library.read_audit_log(symbol=[symbol, symbol2])
151+
152+
assert symbols_audit_log == [{u'new_v': 1, u'symbol': u'TS2', u'message': u'l2', u'user': u'u2', u'orig_v': 0},
153+
{u'new_v': 2, u'symbol': u'TS1', u'message': u'l2', u'user': u'u2', u'orig_v': 1},
154+
{u'new_v': 1, u'symbol': u'TS1', u'message': u'l1', u'user': u'u1', u'orig_v': 0}]
155+
156+
145157
symbol_message_audit_log = library.read_audit_log(symbol=symbol, message='l2')
146158

147159
assert symbol_message_audit_log == [{u'new_v': 2, u'symbol': u'TS1', u'message': u'l2', u'user': u'u2', u'orig_v': 1}, ]

0 commit comments

Comments
 (0)