Skip to content

Commit

Permalink
base for slice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed May 3, 2017
1 parent dfe3ea4 commit 370f93f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/transformer/test_slice.py
@@ -0,0 +1,18 @@
from tests import e_eval


def test_slice():
low = 1
high = 4
stride = 3

assert e_eval('[1, 2, 3, 4, 5]') == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][:]') == [1, 2, 3, 4, 5]
assert e_eval('[1, 2, 3, 4, 5][' + low + ':]') == []
assert e_eval('[1, 2, 3, 4, 5][:' + high + ']') == []
assert e_eval('[1, 2, 3, 4, 5][' + low + ':' + high + ']') == []
assert e_eval('[1, 2, 3, 4, 5][::' + stride + ']') == []
assert e_eval('[1, 2, 3, 4, 5][' + low + '::' + stride + ']') == []
assert e_eval('[1, 2, 3, 4, 5][:' + high + ':' + stride + ']') == []
assert e_eval('[1, 2, 3, 4, 5][' + low + ':' + high + ':' + stride + ']') \
== []

0 comments on commit 370f93f

Please sign in to comment.