diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-11-23 10:06:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-23 10:06:57 +0100 |
commit | 96b0a7742a243dbcdacdcdcc64e141437a40835a (patch) | |
tree | 3a085a20e202c339d60cf4cf68b867e2b532e13f /tests/codec/ber/test_encoder.py | |
parent | f10434e31f9293c4e739ac6c5d1519f407bd1540 (diff) | |
parent | cda318a63f8d6a3c43408ac8d3dfa405d3ca7c7c (diff) | |
download | pyasn1-git-96b0a7742a243dbcdacdcdcc64e141437a40835a.tar.gz |
Make BER/CER/DER decodersstreaming and suspendible (#176)
The goal of this change is to make the decoder yielding on input
data starvation and resuming from where it stopped whenever the
caller decides to try again (hopefully making sure that some more
input becomes available).
This change makes it possible for the decoder to operate on streams
of data (meaning that the entire DER blob might not be immediately
available on input).
On top of that, the decoder yields partially reconstructed ASN.1
object on input starvation making it possible for the caller to
inspect what has been decoded so far and possibly consume partial
ASN.1 data.
All these new feature are natively available through
`StreamingDecoder` class. Previously published API is implemented
as a thin wrapper on top of that ensuring backward compatibility.
Diffstat (limited to 'tests/codec/ber/test_encoder.py')
-rw-r--r-- | tests/codec/ber/test_encoder.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/codec/ber/test_encoder.py b/tests/codec/ber/test_encoder.py index 3ba658a..49eb91d 100644 --- a/tests/codec/ber/test_encoder.py +++ b/tests/codec/ber/test_encoder.py @@ -377,19 +377,19 @@ class RealEncoderTestCase(BaseTestCase): def testBin3(self): # change binEncBase in the RealEncoder instance => for all further Real - binEncBase, encoder.typeMap[univ.Real.typeId].binEncBase = encoder.typeMap[univ.Real.typeId].binEncBase, 16 + binEncBase, encoder.TYPE_MAP[univ.Real.typeId].binEncBase = encoder.TYPE_MAP[univ.Real.typeId].binEncBase, 16 assert encoder.encode( univ.Real((0.00390625, 2, 0)) # check encbase = 16 ) == ints2octs((9, 3, 160, 254, 1)) - encoder.typeMap[univ.Real.typeId].binEncBase = binEncBase + encoder.TYPE_MAP[univ.Real.typeId].binEncBase = binEncBase def testBin4(self): # choose binEncBase automatically for all further Real (testBin[4-7]) - binEncBase, encoder.typeMap[univ.Real.typeId].binEncBase = encoder.typeMap[univ.Real.typeId].binEncBase, None + binEncBase, encoder.TYPE_MAP[univ.Real.typeId].binEncBase = encoder.TYPE_MAP[univ.Real.typeId].binEncBase, None assert encoder.encode( univ.Real((1, 2, 0)) # check exponent = 0 ) == ints2octs((9, 3, 128, 0, 1)) - encoder.typeMap[univ.Real.typeId].binEncBase = binEncBase + encoder.TYPE_MAP[univ.Real.typeId].binEncBase = binEncBase def testBin5(self): assert encoder.encode( |