summaryrefslogtreecommitdiff
path: root/tests/type/test_univ.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/type/test_univ.py')
-rw-r--r--tests/type/test_univ.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/type/test_univ.py b/tests/type/test_univ.py
index 169b73e..de7cdee 100644
--- a/tests/type/test_univ.py
+++ b/tests/type/test_univ.py
@@ -1090,6 +1090,13 @@ class SequenceOf(BaseTestCase):
# this is a deviation from standard sequence protocol
assert not s[2]
+ def testGetItemSlice(self):
+ s = self.s1.clone()
+ s.extend(['xxx', 'yyy', 'zzz'])
+ assert s[:1] == [str2octs('xxx')]
+ assert s[-2:] == [str2octs('yyy'), str2octs('zzz')]
+ assert s[1:2] == [str2octs('yyy')]
+
def testSetItem(self):
s = self.s1.clone()
s.append('xxx')
@@ -1097,6 +1104,16 @@ class SequenceOf(BaseTestCase):
assert len(s) == 3
assert s[1] == str2octs('')
+ def testSetItemSlice(self):
+ s = self.s1.clone()
+ s[:1] = ['xxx']
+ assert s == [str2octs('xxx')]
+ s[-2:] = ['yyy', 'zzz']
+ assert s == [str2octs('yyy'), str2octs('zzz')]
+ s[1:2] = ['yyy']
+ assert s == [str2octs('yyy'), str2octs('yyy')]
+ assert len(s) == 2
+
def testAppend(self):
self.s1.clear()
self.s1.setComponentByPosition(0, univ.OctetString('abc'))