Skip to content

Commit

Permalink
Fix handling of int lists in SelectorMethods.tokens_to_str(), fix uni…
Browse files Browse the repository at this point in the history
…t tests for SelectorMethods.collapse().
  • Loading branch information
lebedov committed Feb 17, 2015
1 parent 300af19 commit cb07321
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion neurokernel/plsel.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def tokens_to_str(cls, tokens):
elif type(t) in [tuple, list]:
if not t:
raise ValueError('invalid token')
result.append('['+','.join(t)+']')
result.append('['+','.join(map(str, t))+']')
else:
raise ValueError('invalid token')
return ''.join(result)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_plsel.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,10 @@ def test_tokens_to_str(self):

def test_collapse(self):
assert self.sel.collapse([]) == ''
assert self.sel.tokens_to_str([['a']]) == '/a'
assert self.sel.collapse([['a']]) == '/a'
assert self.sel.collapse([['a', 0]]) == '/a/0'
assert self.sel.collapse([('a', 0)]) == '/a/0'
assert self.sel.collapse([['a', 'b', 0]]) == '/a/0'
assert self.sel.collapse([['a', 'b', 0]]) == '/a/b/0'
assert self.sel.collapse([['a', 0], ['b', 0]]) == '/a/0,/b/0'
assert self.sel.collapse([['a', 'b', (0, 1)], ['c', 'd']]) == '/a/b[0,1],/c/d'

Expand Down

0 comments on commit cb07321

Please sign in to comment.