aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-09-10 17:57:08 +0200
committerIlya Etingof <etingof@gmail.com>2017-09-10 17:57:08 +0200
commit9ca6884c92d68e15942539c6126c0e5b00643c41 (patch)
tree9e86864806013068d7278f20039055ae9fe98848 /tests
parentc550820832cc8593eed2398e87d27d323dfc39a3 (diff)
downloadpyasn1-9ca6884c92d68e15942539c6126c0e5b00643c41.tar.gz
refer to open types by open types, not hole types
Diffstat (limited to 'tests')
-rw-r--r--tests/codec/ber/test_decoder.py54
1 files changed, 25 insertions, 29 deletions
diff --git a/tests/codec/ber/test_decoder.py b/tests/codec/ber/test_decoder.py
index 45cd530..85c71fb 100644
--- a/tests/codec/ber/test_decoder.py
+++ b/tests/codec/ber/test_decoder.py
@@ -10,7 +10,7 @@ try:
except ImportError:
import unittest
-from pyasn1.type import tag, namedtype, univ, char, definedby
+from pyasn1.type import tag, namedtype, opentype, univ, char
from pyasn1.codec.ber import decoder, eoo
from pyasn1.compat.octets import ints2octs, str2octs, null
from pyasn1.error import PyAsn1Error
@@ -825,7 +825,7 @@ class SequenceDecoderWithSchemaTestCase(unittest.TestCase):
class SequenceDecoderWithIntegerHoleTypesTestCase(unittest.TestCase):
def setUp(self):
- definedBy = definedby.DefinedBy(
+ openType = opentype.OpenType(
'id',
[(1, univ.Integer()),
(2, univ.OctetString())]
@@ -833,48 +833,44 @@ class SequenceDecoderWithIntegerHoleTypesTestCase(unittest.TestCase):
self.s = univ.Sequence(
componentType=namedtype.NamedTypes(
namedtype.NamedType('id', univ.Integer()),
- namedtype.NamedType('blob', univ.Any(), definedBy=definedBy)
+ namedtype.NamedType('blob', univ.Any(), openType=openType)
)
)
- # def testChoiceOne(self):
- # s, r = decoder.decode(
- # ints2octs((48, 6, 2, 1, 1, 2, 1, 12)),
- # asn1Spec=self.s
- # )
- # assert not r
- # assert s[0] == 1
- # assert s[1] == ints2octs((2, 1, 12))
- #
- # def testChoiceTwo(self):
- # s, r = decoder.decode(
- # ints2octs((48, 16, 2, 1, 2, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)),
- # asn1Spec=self.s
- # )
- # assert not r
- # assert s[0] == 1
- # assert s[1] == ints2octs((4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110))
-
- def testChoiceOneResolveHoles(self):
+ def testChoiceOneDecodeHoles(self):
s, r = decoder.decode(
- ints2octs((48, 6, 2, 1, 1, 2, 1, 12)), asn1Spec=self.s
-# TODO
-# resolveHoleTypes=True
+ ints2octs((48, 6, 2, 1, 1, 2, 1, 12)), asn1Spec=self.s,
+ decodeOpenTypes=True
)
assert not r
assert s[0] == 1
assert s[1] == 12
- def testChoiceTwoResolveHoles(self):
+ def testChoiceTwoDecodeHoles(self):
s, r = decoder.decode(
- ints2octs((48, 16, 2, 1, 2, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)), asn1Spec=self.s
-# TODO
-# resolveHoleTypes = True
+ ints2octs((48, 16, 2, 1, 2, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)), asn1Spec=self.s,
+ decodeOpenTypes = True
)
assert not r
assert s[0] == 2
assert s[1] == univ.OctetString('quick brown')
+ def testChoiceOneDontDecodeHoles(self):
+ s, r = decoder.decode(
+ ints2octs((48, 6, 2, 1, 1, 2, 1, 12)), asn1Spec=self.s
+ )
+ assert not r
+ assert s[0] == 1
+ assert s[1] == ints2octs((2, 1, 12))
+
+ def testChoiceTwoDontDecodeHoles(self):
+ s, r = decoder.decode(
+ ints2octs((48, 16, 2, 1, 2, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110)), asn1Spec=self.s
+ )
+ assert not r
+ assert s[0] == 2
+ assert s[1] == ints2octs((4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110))
+
class SetDecoderTestCase(unittest.TestCase):
def setUp(self):