Skip to content

Commit

Permalink
Merge pull request #55 from zopefoundation/slice_fixes
Browse files Browse the repository at this point in the history
fix some spelling and conventions
  • Loading branch information
loechel committed May 3, 2017
2 parents 2037b76 + d9cc70a commit 5c8a319
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/transformer/test_slice.py
@@ -1,3 +1,4 @@
from operator import getitem
from tests import e_eval

import pytest
Expand All @@ -9,15 +10,14 @@ def test_slice(e_eval):
high = 4
stride = 3

from operator import getitem
rgbl = dict(_getitem_=getitem) # restricted globals
rglb = {'_getitem_': getitem} # restricted globals

assert e_eval('[1, 2, 3, 4, 5]', rgbl) == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][:]', rgbl) == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][%d:]' % low, rgbl) == [2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][:%d]' % high, rgbl) == [1, 2, 3, 4]
assert e_eval('[1, 2, 3, 4, 5][%d:%d]' % (low, high), rgbl) == [2, 3, 4]
assert e_eval('[1, 2, 3, 4, 5][::%d]' % stride, rgbl) == [1, 4]
assert e_eval('[1, 2, 3, 4, 5][%d::%d]' % (low, stride), rgbl) == [2, 5]
assert e_eval('[1, 2, 3, 4, 5][:%d:%d]' % (high, stride), rgbl) == [1, 4]
assert e_eval('[1, 2, 3, 4, 5][%d:%d:%d]' % (low, high, stride), rgbl) == [2] # NOQA: E501
assert e_eval('[1, 2, 3, 4, 5]', rglb) == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][:]', rglb) == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][%d:]' % low, rglb) == [2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][:%d]' % high, rglb) == [1, 2, 3, 4]
assert e_eval('[1, 2, 3, 4, 5][%d:%d]' % (low, high), rglb) == [2, 3, 4]
assert e_eval('[1, 2, 3, 4, 5][::%d]' % stride, rglb) == [1, 4]
assert e_eval('[1, 2, 3, 4, 5][%d::%d]' % (low, stride), rglb) == [2, 5]
assert e_eval('[1, 2, 3, 4, 5][:%d:%d]' % (high, stride), rglb) == [1, 4]
assert e_eval('[1, 2, 3, 4, 5][%d:%d:%d]' % (low, high, stride), rglb) == [2] # NOQA: E501

0 comments on commit 5c8a319

Please sign in to comment.