aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-09-14 19:52:52 +0200
committerIlya Etingof <etingof@gmail.com>2017-09-14 19:52:52 +0200
commitcebfcb2d328ee42151ac8822b135613aa025fc54 (patch)
treee493199e54968e4281ff2a669cf9ea424723256d /tests
parentc40b8c22c9679e017871617d7cf558b1b7f0ff84 (diff)
parent154c55b30e335482a074ac76ad4e5abdc41ccc8b (diff)
downloadpyasn1-cebfcb2d328ee42151ac8822b135613aa025fc54.tar.gz
Merge branch 'master' into open-types-support
Diffstat (limited to 'tests')
-rw-r--r--tests/codec/der/test_encoder.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/codec/der/test_encoder.py b/tests/codec/der/test_encoder.py
index d30dfc1..354781a 100644
--- a/tests/codec/der/test_encoder.py
+++ b/tests/codec/der/test_encoder.py
@@ -17,31 +17,28 @@ from pyasn1.error import PyAsn1Error
class OctetStringEncoderTestCase(unittest.TestCase):
- def testShortMode(self):
+ def testDefModeShort(self):
assert encoder.encode(
univ.OctetString('Quick brown fox')
) == ints2octs((4, 15, 81, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 32, 102, 111, 120))
- def testIndefMode(self):
- try:
- encoder.encode(univ.OctetString('Quick brown'), defMode=False)
- except PyAsn1Error:
- pass
- else:
- assert 0, 'Indefinite length encoding tolerated'
-
- def testChunkedMode(self):
+ def testDefModeLong(self):
assert encoder.encode(
- univ.OctetString('Quick brown'), maxChunkSize=2
- ) == ints2octs((4, 11, 81, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110))
+ univ.OctetString('Q' * 10000)
+ ) == ints2octs((4, 130, 39, 16) + (81,) * 10000)
class BitStringEncoderTestCase(unittest.TestCase):
- def testShortMode(self):
+ def testDefModeShort(self):
assert encoder.encode(
univ.BitString((1,))
) == ints2octs((3, 2, 7, 128))
+ def testDefModeLong(self):
+ assert encoder.encode(
+ univ.BitString((1,) * 80000)
+ ) == ints2octs((3, 130, 39, 17, 0) + (255,) * 10000)
+
class SetOfEncoderTestCase(unittest.TestCase):
def setUp(self):